About ADF Entity Object
ADF Entity Object is providing a gateway to do DML operation to database tables. In ADF, if a user does create/Delete/Update or any custom DML operation on tables then it most likely happens through Entity objects.
On the other hand, View Object is useful to view the records in the table, most likely for Select Queries. So ,
Entity Object = Add/Update/Delete record in a table
View Object = Select record in table with Where and GroupBy support
In this section, I have explained how we can use Entity Object Java classes
HR Schema (Comes with Oracle Database)
ADF Entity Object Example:
I have already created an Entity Object and its Java classes of Country table. I used the EO Java class in this example.
1. As you see below, the generated Entity Object Java class has the below overridden methods
- The Create() method executes whenever a row is inserted into the Country table (Here the record is residing in cache memory of ADF)
- The remove() method executes whenever a row is deleted in Country table (The delete happens in cache memory of ADF )
- The doDML() method executes whenever commit occurs for create/remove
2. We can add any custom Java code on each method so that the custom code execute before the actual override method executing. I have inserted a print statement on each method as shown below, the print statement will execute first whenever a row in Country table get Created/Updated or Deleted.
Test the operation
1. ADF provides an easy way to test the Entity & View Objects without the need for creating a JSF page or deploying it on the server.
Right click on the App Module and click Run as shown below
2. App Module wizard will appear on the screen. Double click on the CountryEOView1. We can perform CRUD operation on this page
- Click the + icon to insert a record into Country table. JDeveloper console produce the following output when you insert a record
Insert Statement Executed
- Click X icon to delete a record in Country table. JDeveloper console produce the following output when you insert a record
Delete Statement Executed
- Click icon to commit the transaction to the database; you will receive the following 0otput in the JDeveloper console
Sometimes we may restrict users to delete any records from the table. We could achieve this by modifying the doDML operation like below
The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.
Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
Latest posts by Govind
- P6 Progress Reporter completely integrated into P6 Team Member - August 15, 2017
- Primavera P6 Professional for EPPM Popup 16.2 : The appropriate industry for your organization has not yet been select in admin preferences - August 15, 2017
- Primavera P6 Background Job Error:Creating job Symon Failed to add Database Job, Check the settings table for valid interval values for dbms_scheduler - August 14, 2017