Wednesday, 11 December 2019

What is EntityImpl class in ADF?

EntityImpl is the implementation class of EntityObject which represents a row which currently there in EntityObject Cache. The row may be a row from a database table or a new Row which is created from the Application.
EntityImpl in oracle ADF

There are a few methods which there in EntityImpl and they are quite useful in the development.

1. public void create (): This method is called whenever a new row is created from the Application. Here we can implement logic to set default values that are needed when a row is created.

Example Logic which can be implemented: 

Suppose you need to store the information about when and by which user a row is being Created. You can implement the logic here. Here in this method, you can write the code to set UserId and CreateDate, the values will be set at the creation of the Row itself.

2. public void doDML(int operation, TransactionEvent e):   This method is called whenever there is any kind of DML operation is going on in the Row. It contains a parameter operation that represents which kind of operation is being done. The operations can be
    DML_INSERT: Insert operation is being done.
    DML_UPDATE: Update on the Entity Row is being done
    DML_DELETE: Delete operation is being done.

Example Logic which can be implemented:

On any update of the Row, we can implement the logic to set the Modified Username and Modified date of the row
  
3. public void remove():  This method is called whenever a row is deleted for removed from the EntityObject.

Example Logic which can be implemented:

Supposed you need to check if there are any child records for the existing current records or not. This logic can be written here.

No comments:

Post a Comment