Sunday, March 4, 2012

How to create ADF Entity Objects

Entity objects are classes that encapsulate the business model , data and its relationship . Suppose for example, we have a table Person in DB and we create one Person entity that maps to the Person table in DB . Each Entity object instance represent a row in table.

Now we will see how to create ADF Entity objects in our ADF Model Project in step by step process ( If you have not created ADF Model project How to Create ADF Sample Application this will tell you how to get ready before creating entity objects)

Step 1:

Right click on AdfDemoModel Project, select New

















Step 2:

Choose the options as per the Screen shot and click  ok.


















Step 3:

In the Initialize Business Component Project you will get to see the Database Connection parameters which is connected with the Database which we configured earlier.If not created from the earlier post den you can create the same using this link  How to Create ADF Sample Application (Refer Step 8). You can also create the Database connection on the spot by clicking on the plus sign near connection drop down.click  ok.

















Step 4 :

Create Entity object - step 1 of 6 dialog window will open up and click Browse as shown in the picture

















Step 5 :

Type the respective database table name in the object name text box (say Empl)  and click query. you will see the EMPLOYEES table in available objects area .  you can also select the object types if required .click ok.

















Step 6 :

Enter the package name and Name as it is in the screen shot .  Suffix EO for all the entity object name to understand  easily as entity objects.

















Step 7 :

All the attributes belongs to the EO will be listed. Click Next

















Step 8:

You can change and add settings for every attribute you required. Primary key is required for Every table you create as EO otherwise it will force you to have RowId as primary key .  In Employess table EmployeeId is the primary key and thus it is made and click Next .


















Step 9 :

You can create java classes for the EO .This java source contains the getter and setter for all the attributes. This is not a mandatory step as you can create any time once EO is created successfully.

















Step 10 :

Optionaly You can check the Generate Default View Object option to generate view object for this EO. I will not check this as i will be telling in complete procedure on  how-to-create-adf-view-objects .  The same applies to Application Module also. Click Next and Finish.

















Step 11 :

You can see the Emloyees EO in the package model.entity . you can also see the association created




 



Oracle ADF associations are business components that define a relationship between two Oracle ADF entity object definitions (the "source" and "destination" entity objects) based on sets of entity attributes (the "source" and "destination" attributes) from each. These can range from simple one-to-many relationships based on foreign keys to complex many-to-many relationships. For example, associations can represent:
  • The one-to-many relationship between a customer and all orders placed by that customer
  • The one-to-one relationship between a product and its extended description (if these are represented by separate entity objects
  • The many-to-many relationship between products and the warehouses that currently stock them

2 comments:

  1. The text in the screen shots is not readable as it is too small. If zoom in the image clarity getting diminished, so unable to read the text in images.

    ReplyDelete
  2. How to we deploy created VOs or EOs to the Server? I am really new to this, i can't figure it out.

    ReplyDelete