0% found this document useful (0 votes)
110 views

Iterate Over Master Detail ViewObject Using View Link Accessor

This document discusses iterating over master and detail view objects in ADF using view link accessors. It explains that the master view object (Departments) has a view link accessor to the detail view object (Employees). Code is provided to get the master rows, then for each master row get the child row set from the view link accessor and iterate over the child rows. The code prints the department name and employee names. Running the application module will log the output to verify the iteration.

Uploaded by

hisham_476
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
110 views

Iterate Over Master Detail ViewObject Using View Link Accessor

This document discusses iterating over master and detail view objects in ADF using view link accessors. It explains that the master view object (Departments) has a view link accessor to the detail view object (Employees). Code is provided to get the master rows, then for each master row get the child row set from the view link accessor and iterate over the child rows. The code prints the department name and employee names. Running the application module will log the output to verify the iteration.

Uploaded by

hisham_476
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

8/27/2016

ADFBasics:IterateovermasterdetailviewObjectusingviewlinkaccessorAshishAwasthi'sBlog(Jdev/ADF)

ADFBasics:IterateovermasterdetailviewObjectusingviewlinkaccessor
HelloAll
Thispostisaboutiteratingovermasterandit'schildviewobjectusing
viewlinkaccessor,thisisverybasicthingofframeworkstillsomefind
(thosewhoarestartingwithADF)itdifficultsoIthoughttowriteit
here
HereIamusingDepartmentsandEmployeestableofHRSchemato
createMasterDetailrelationandduetoviewlinkrelation,Department
viewObjecthasviewlinkaccessorofEmployeesviewObject

Thisviewlinkaccessorcontainesrowsforcorrespondingrowofmaster
(Departments)viewObject,Itreturnsdifferentrowset(listof
Employees)foreachrecordofDepartmentsviewObjectandwecan
programmaticallyaccessthisviewlinkaccessorforeachmasterrecord

CodeinAMImpltoIterateoverMasterandDetailviewobjectrecords
importoracle.jbo.Row;
importoracle.jbo.RowSet;
importoracle.jbo.RowSetIterator;
importoracle.jbo.ViewObject;
/**
*ThisisthemethodtoiterateoverDepartmentsandcorrespondingEmployeesrecords
*/
http://www.awasthiashish.com/2016/08/adfbasicsiterateovermasterdetail.html

1/2

8/27/2016

ADFBasics:IterateovermasterdetailviewObjectusingviewlinkaccessorAshishAwasthi'sBlog(Jdev/ADF)

publicvoiditerateMasterDetail(){
//GetMasterViewObject
ViewObjectdeptVo=this.getDepartmentsView();
//CreateiteratortoiterateovermasterviewObject
RowSetIteratorrsi=deptVo.createRowSetIterator(null);
while(rsi.hasNext()){
//GetMasterViewObjectRow
RowdepartmentsRow=rsi.next();
System.out.println("DepartmentName:"+departmentsRow.getAttribute("DepartmentName"));
//GetCorrespondingchildviewobjectaccessor
RowSetrs=(RowSet)departmentsRow.getAttribute("EmployeesView");
//IterateoverchildviewObjectrowsforcorrespondingmasterrecord
while(rs.hasNext()){
Rowr=rs.next();
System.out.println("Employee:"+r.getAttribute("FirstName")+""+
r.getAttribute("LastName"));
}
}
//CloseMasterviewObjectiterator
rsi.closeRowSetIterator();
}

AddthismethodtoclientinterfaceofApplicationModuleandRunApplicationModuletocheckit

Outputonlog

CheersHappyLearning

http://www.awasthiashish.com/2016/08/adfbasicsiterateovermasterdetail.html

2/2

You might also like