Create Entity Object for Oracle ADF Components Layer in Application


Lets look how we accutaly built Oracle ADF Components layer for our application. The first step is usually creating Entity Objects and this involves following steps.


1) Mapping to database tables
2) Choosing specific attributes
3) Set attribute properties


Start Oracle JDeveloper, Click on New Application and from Categories select Application and from Item select Fusion Web Application (ADF)





Enter Application Name and than click on Finish




Right Click on Model and choose New




From the Business Tire category select ADF Business Components and from items select Business Components from Tables




Create the Connection to the Oracle Database




Query the Database Schema and move the Entities from Available to Selected window. In my case I am moving Department and Employees Entities. Rename the Package model from model.eo (for ease to remember)




Create the Entities based Views and rename the package as shown and than click on Finish





We can define two types of attribute

a) Control Functionality and behaviour such as Mandatory fields, Default values of the fields and also set the database interaction properties etc.
b) UI Hints – default UI representation such as Label of the fields, Tooltip, Format mask and control types etc



Expand the model.eo package and open the Employees entity. Click on Attributes and select the hiredate field from Employees entity. Now we will set the following attributes on the hiredate field.


1) Setting the default date value using the Groovy Expression
2) Setting the Label, Tool Tip, Format Type and Format on hiredate field






Save the Project. Expand model.vo package, right click on AppModule and choose run. 




Oracle ADF provides swing based interface to interact our View Object. Double Click on EmployeesView1 and than click on plus sign to create a record. You will see that the default value of the hiredate date filed, Label is also set as we did. Move the mouse cursor to the hiredate field, Tool Tip will also appear automatically.



Next we will do the field level validation in Oracle ADF Application

Comments

Popular posts from this blog

Create Tables in Oracle Database using TOAD

How to create Oracle stored Procedures using TOAD for Oracle

How to Create Packages in Oracle Database using TOAD for Oracle