mydomain
No ADS
No ADS

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

  1. The Objective of the Lesson 
  2. Creation of Oracle ADF application
  3. Association and View Link
  4. Creation of View Object and View Link
  5. Create the website with the Master-Details
  6. Run the application

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).
  • Association and the concept describing the constraint between Entity Objects.
  • 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

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

3. Association and View Link

No ADS
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 anAssociation.

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 theDatabase. 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

No ADS
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

No ADS
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 theview5.jsf window and create a Master-Detail:

6. Run the application

No ADS
Select the view5 on theadf-config.xml window and press RUN to run.
No ADS
No ADS