Saturday 30 November 2019

What is an Entity Object in Oracle ADF?

EntityObject in ADF represents an individual Object in the data source. Such as database Tables. It contains all the properties of the database table.

Analogy: EntityObject in oracle ADF represents a table in the database which stores the data.


Entity Object contains all the properties of the database table, such as Database Constraints, Primary Keys, Foreign Keys, etc. and also table column properties such as Columns, Column Type, Column Precision Scale, Column Default Value, etc.

Entity Object is responsible for facilitating DML operation in database tables. Before it pushes the data in the database it validates with all the constrains of the database table and ensures that all the data it is sending in the data is correct. This helps in avoiding any corrupt data posting in the database. This helps in reducing database calls and adds to the real-time performance of the Application.  



Similarity between Database Objects and ADF Business Components

Oracle ADF is an Application development framework for Rapid Application Development. Oracle ADF uses Business components in the Model Layer to perform the transactions. ADF Business components are similar to Database Objects.

Suppose we have to create a database to store Department and Employee data in the database. For this, we will have to create two tables DEPARTMENTS and EMPLOYEES where DEPARTMENTS will be a master and EMPLOYEES will be detail table.

For the above scenario, we will have to do the following in the database.
  1. Create table DEPARTMENTS.
  2. Create table EMPLOYEES.
  3. Create a Foreign Key between DEPARTMENTS and EMPLOYEES to establish a master-detail relationship.
  4. SQL Query to perform DML operations i.e Create, Read, Update and Delete operations.

 If we have to create an ADF application for viewing and updating the above database structure then the following Business Objects will be created.
  1. Entity Object "DepartmentsEO" to represent the DEPARTMENTS Table.
  2. Entity Object "EmployeesEO" to represent the "EMPLOYEES" Table.
  3. Association "DeptToEmpAS" to represent the Foreign Key relationship.
  4. ViewObject "DepartmentsVO" and "EmployeeVO" to represent the SQL queries to represent DEPARTMENTS and EMPLOYEES tables respectively.

 In short, we can understand the similarity with the image below.