There could be may scenarios where we would need to populate primary keys with DBSequence. If this is the
requirement then best place to populate them would be initDefaults() method of EOImpl.java
Open the EOImpl.java file and overwrite initDefaults() as shown in sample code :
@Override
protected void initDefaults()
{
super.initDefaults();
SequenceImpl seq = new SequenceImpl("SEQ_NAME", getDBTransaction());
populateAttributeAsChanged(CONTRACTID, seq.getSequenceNumber());
}
CONTRACTID is the name of the attribute identifier and SEQ_NAME is the name of the Sequence.
No comments:
Post a Comment