There are two ways to assign database sequence value in OAF, DB sequence value can be assign to EO or at VO level.
Create sequence in database
CREATE SEQUENCE XX_EMP_SEQ START WITH 1 INCREMENT BY 1;
Assign DB sequence value in EO
Go to your EOImpl.java and write the below code in create constructor
public void create(AttributeList attributeList) {
super.create(attributeList);
super.create(attributeList);
OADBTransaction transaction = getOADBTransaction();
Number seqNo = transaction.getSequenceValue("XX_EMP_SEQ");
setFileId(seqNo);
}
Assign DB sequence value in VO
OAViewObject vo = (OAViewObject)findViewObject("XXEmployeesVO");
OARow row = (OARow)vo.first();
row.setAttribute("EmployeeId", getOADBTransaction().getSequenceValue("XX_EMP_SEQ").toString());
OARow row = (OARow)vo.first();
row.setAttribute("EmployeeId", getOADBTransaction().getSequenceValue("XX_EMP_SEQ").toString());
No comments:
Post a Comment