EntityImpl class in Oracle ADF

Photo by Aman Junaid, Jhumka Bandh, Baikunthpur

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

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

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.

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.

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.

Originally published at https://adfjavacodes.blogspot.com.

Software Engineer