ADF Basics: Iterate over master detail viewObject using view link accessor

Sharing is Caring

Hello All, This post is about iterating over the master and its child view object using view link accessor, this is a very basic thing of framework still some find (those who are starting with ADF) it difficult so I thought to write it here

Here I am using Departments and Employees table of HR Schema to create Master-Detail relation and due to view link relation, Department viewObject has viewlink accessor of Employees view object

This view link accessor contains rows for corresponding row of master (Departments) viewObject, It returns different rowset (list of Employees) for each record of Departments viewObject and we can programmatically access this viewlink accessor for each master record

view link accessor


The code in AMImpl to Iterate over Master and Detail view object records

import oracle.jbo.Row;
import oracle.jbo.RowSet;
import oracle.jbo.RowSetIterator;
import oracle.jbo.ViewObject;

 * This is the method to iterate over Departments and corresponding Employees records
public void iterateMasterDetail() {
//Get Master ViewObject
ViewObject deptVo = this.getDepartmentsView();
//Create iterator to iterate over master viewObject
RowSetIterator rsi = deptVo.createRowSetIterator(null);

while (rsi.hasNext()) {
//Get Master ViewObject Row
Row departmentsRow =;
System.out.println("Department Name :" + departmentsRow.getAttribute("DepartmentName"));
//Get Corresponding child viewobject accessor
RowSet rs = (RowSet) departmentsRow.getAttribute("EmployeesView");

//Iterate over child viewObject rows for corresponding master record
while (rs.hasNext()) {
Row r =;
System.out.println(" Employee : " + r.getAttribute("FirstName") + " " +
//Close Master viewObject iterator

Add this method to the client interface of the Application Module and Run Application Module to check it

Output on log

Cheers 🙂 Happy Learning

Related Posts

0 thoughts on “ADF Basics: Iterate over master detail viewObject using view link accessor”

Leave a Reply

Your email address will not be published. Required fields are marked *