Undertanding Associations, View Links and Master-Detail in Oracle ADF BC

View more categories:

1- The Objective of the Lesson 

In this lesson, I will explain about  the  Association and  View Link in Oracle ADF Bussiness Components ( Oracle ADF BC).
  1. Association and the concept describing the constraint between Entity Objects.
  2. View Link is the concept describing the constraint between View Objects.
The two above concepts help you create a Master-Detail application, like the following illustration:

2- Creation of Oracle ADF application

First of all, you need to create an ADF application with basic settings:
  1. Create "ADF Fusion Web Application".
  2. Connect to a database.
  3. Create Application Module.
  4. Create Entity Objects.
  5. Create default View Objects.
You can see here:
After this step, you obtain an application as the following illustration:

3- Association and View Link

Entity Object & Associations

As you know, the  Tables in the Database have a constraint with each other by Foreign Keys.
Entity Object is a concept in Oracle ADF BC, which corresponds to one Table in a database and they have a constraint with each other by an   Association.

Thus, the concept of Association of the  Oracle ADF BC is equivalent to one of Foreign Key in the Database.

View Object & View Link

View Object is a concept of Oracle ADF BC, which corresponds to the VIEW concept in the  Database. The  View Object can be based on a  SQL statement.
The View Link is a constraint between View Objects, which is equivalent to the  Association, a constraint between  Entity Objects.

4- Creation of View Object and View Link

Now, we will create 2 View Objects called   V05Departments and  V05Employees, and then create a View Link to constraint 2 View Objects under the condition of  V05Departments.DepartmentId = V05Employees.DepartmentId.

Create View Object: V05Departments

On JDeveloper select:
  • File/New/From Gallery
    • >> Bussiness Tier/ADF Bussiness Components/View Object
Check to choose  "Data Source = Entity" in order to create a  View Object from  Entity Objects.
View Object (V05Departments) has been created.

Create View Object: V05Employees:

Similarly, we continue to create another  View Object named  V05Employees:
The V05Employees ( View Object) has been created.

Create View Link

Next, we will create a  View Link to constraint  two  View Objects: V05Departments and  V05Employees under the condition of  V05Department.DepartmentId = V05Employees.DepartmentId.
On JDeveloper select:
  • File/New/From Gallery
    • >> Bussiness Tier/ADF Bussiness Components/View Link
Enter:
  • Package: org.o7planning.adf.model.viewlinks
  • Name: V05EmpV05DeptViewLink
The V05EmpV05DeptViewLink ( View Link) has been created.

Register V05Departments & V05Employees with Application Module:

Test the application by Oracle ADF Model Tester

5- Create the website with the Master-Details

Open adf-config.xml:
Drag and drop the View object into the  adf-config.xml window:
Double click on the  "view5" on the   adf-config.xml window to create a source file for it.
Look for and drag and drop the "Decorative Box (ADF Faces.Layout)" object into the  view5.jsf window:
Drag and drop the  V05Employees1 from  Data Controls into the  Center region on the   view5.jsf window and create a  Master-Detail:

6- Run the application

Select the  view5 on the   adf-config.xml window and press RUN to run.

View more categories: