Oracle ADF view links are business components that defines a relationship between two ADF view objects . when we say relationship between two ADF view objects and it is obvious it can be used in Master-Detail data representation . For more info on Master-Detail relationship ADF Master - Detail Relationship .
In general view objects contains query that queries the database and view link will relate those queries using where clause.
For ex : you want to render employees based on department as a master - child ..
View Link = DepartmentsVO --> EmployeesVO
select DepartmentId from DepartmentsVO and DepartmentId from EmployeesVO and the click Add . Let cardinality be 1 to * [ Means : One department can contain many employees ] This cardinality will have an impact in the accessor generation .
In the next step
Generate Accessor :
By default Destination Accessor , In View Object : DepartmentsVO check box ll be selected . we will check the In View Object : Employees VO in the Source Accessor. This will add some code in both the VO Row Impl class .
DepartmentsVO :
public RowIterator getEmployeesVO() {
return (RowIterator)getAttributeInternal(EMPLOYEESVO);
}
Employees VO :
public Row getDepartmentsVO() {
return (Row)getAttributeInternal(DEPARTMENTSVO);
}
The cardinality is 1 to * [1 to Many ] so ideally a department can be able to get all employees in it and tats why it has an accessor defined in its DepVORowImpl class with return type Row Iterator . And the accessor in EmpVORowImpl will return a single row (as an employee can be in only one dept )
In general view objects contains query that queries the database and view link will relate those queries using where clause.
For ex : you want to render employees based on department as a master - child ..
View Link = DepartmentsVO --> EmployeesVO
select DepartmentId from DepartmentsVO and DepartmentId from EmployeesVO and the click Add . Let cardinality be 1 to * [ Means : One department can contain many employees ] This cardinality will have an impact in the accessor generation .
In the next step
Generate Accessor :
By default Destination Accessor , In View Object : DepartmentsVO check box ll be selected . we will check the In View Object : Employees VO in the Source Accessor. This will add some code in both the VO Row Impl class .
DepartmentsVO :
public RowIterator getEmployeesVO() {
return (RowIterator)getAttributeInternal(EMPLOYEESVO);
}
Employees VO :
public Row getDepartmentsVO() {
return (Row)getAttributeInternal(DEPARTMENTSVO);
}
The cardinality is 1 to * [1 to Many ] so ideally a department can be able to get all employees in it and tats why it has an accessor defined in its DepVORowImpl class with return type Row Iterator . And the accessor in EmpVORowImpl will return a single row (as an employee can be in only one dept )
No comments:
Post a Comment