Sunday, March 4, 2012

How to create ADF View Objects

What is View Object ?
A Typical View Object that lets you to work with set of rows .  View object contains SQL Query that collects data from Database . It can be associated with underlying entity object. At the same time VO query can be formed from various entity objects.

Step 1 :

Right click on AdfDemoModel project and select New (NOTE:If you have not created ADF Model project How to Create ADF Sample Application this will tell you how to get ready before creating View objects.View objects we create is based on entity objects which we created already.If you have not create entity objects yet, this will tell you how-to-create-entity-object ).

















Step 2 :

Select the options as in the below screen shot

















Step 3 ;

Enter Package : model.view , Name : EmployeesVO (since we are going to create employee VO out of employee EO ) . Select Updatable access through entity objects radio button. we will do CRUD operations later using this VO from UI ( Insert,Update operation). There are setting that you can set the way VO works (For ex : read only VO , this just helps to read data from DB not to do any CRUD operations) . Click Next
















Step 4 :

Select the EmployeesEO from Avaiable area and shuttle it to Selected area and click Next .

















Step 5 :

Shuttle all the attributes from left to right.

















Step 6 :

Attribute settings can be made and there are various options .
Just click Next

















Step 7 :

Using this step we can edit query .  Query can be edited from selecting Expert from SQL Mode drop down.
we can add where clause and order by to the existing query .Click Ok

















Step 8 :

Bind variable can be added to the VO and it can be appended to the query at run time . Just Click Next


Step 9:

Java files can be generated for the VO which contains the getter and setter methods for the VO attributes.
















Step 10 :

Check the application module check box and type as given in the below screen shot and click Next and click Finish. NOTE : If you uncheck this option when creating VO then we need to externally create AM and add VO instance to it . Refer how-to-create-adf-application-module and add VO to it . If you check application module when creating VO, then you can skip the lesson how-to-create-adf-application-module and add VO to it .

















Step 11 :

Final look of just created VO

















NOTE :  we can also create VO when creating Entity Object ( adf-model-how-to-create-entity-object Step 10) . This is direct approach .








No comments:

Post a Comment