The mentioned example demonstrates a scenario where EmployeeID attribute is supposed to be populated from sequence names emp_seq
1. Make sure that the EntityIMPL class has been defined for the entity to be used(EmployeeEO in this case)
2. Over ride the create method as follows:
/**
* Add attribute defaulting logic in this method.
* @param attributeList list of attribute names/values to initialize the row
*/
protected void create(AttributeList attributeList) {
super.create(attributeList);
setEmployeeId(nextSequenceVal("EMP_SEQ"));
}
public Number nextSequenceVal(String seqName){
SequenceImpl seq=new SequenceImpl(seqName,getDBTransaction());
System.out.println("seqence no "+seq.getSequenceNumber()+" "+seq.getSequenceNumber());
return seq.getSequenceNumber();
}
3. Use the corresponding VO as required on the jspx page
1. Make sure that the EntityIMPL class has been defined for the entity to be used(EmployeeEO in this case)
2. Over ride the create method as follows:
/**
* Add attribute defaulting logic in this method.
* @param attributeList list of attribute names/values to initialize the row
*/
protected void create(AttributeList attributeList) {
super.create(attributeList);
setEmployeeId(nextSequenceVal("EMP_SEQ"));
}
public Number nextSequenceVal(String seqName){
SequenceImpl seq=new SequenceImpl(seqName,getDBTransaction());
System.out.println("seqence no "+seq.getSequenceNumber()+" "+seq.getSequenceNumber());
return seq.getSequenceNumber();
}
3. Use the corresponding VO as required on the jspx page
No comments:
Post a Comment