Sometimes we might need the attribute's modified value and the original value before committing the data to the database. We might need the data either to store the history of changes to a particular record or for any other purpose. We have to override the doDML() method of the EOImpl method and use the getPostedAttribute() to get the original value
Using the getPostedAttribute() method, your entity object business logic can consult the original value for any attribute as it was read from the database before the entity row was modified. This method takes the attribute index as an argument, so pass the appropriate generated attribute index enums that JDeveloper maintains for you.
Sample code is as below
protected void doDML(int operation, TransactionEvent e) {
System.out.println("First Name old value: " + getPostedAttribute(AttributesEnum.FirstName.index()));
// Or use the index directly
System.out.println("First Name old value: " + getPostedAttribute(EMPLOYEEID));
System.out.println("First Name new value: " + getFirstName());
super.doDML(operation, e);
}
Using the getPostedAttribute() method, your entity object business logic can consult the original value for any attribute as it was read from the database before the entity row was modified. This method takes the attribute index as an argument, so pass the appropriate generated attribute index enums that JDeveloper maintains for you.
Sample code is as below
protected void doDML(int operation, TransactionEvent e) {
System.out.println("First Name old value: " + getPostedAttribute(AttributesEnum.FirstName.index()));
// Or use the index directly
System.out.println("First Name old value: " + getPostedAttribute(EMPLOYEEID));
System.out.println("First Name new value: " + getFirstName());
super.doDML(operation, e);
}
No comments:
Post a Comment