First page Back Continue Last page Graphics

Iterating Master–Detail Hierarchy


Iterating Master–Detail Hierarchy

The sample code, placed in a test client, iterates over all departments and their associated employees in a master-detail hierarchy. The beginning of the code sets up standard test client code, which you learn to do shortly. The remaining code performs the following actions:

1. Finds the DepartmentsView1 view object

2. Executes the view object query

3. Iterates over the resulting rows

4. Prints out the department name

5. Gets the related RowSet of employees by using the view link accessor

6. Iterates over the employees rows

7. Prints out the last name of each employee

The beginning of the resulting output looks like this:

Department 10

Employee Name: Whalen

Department 20

Employee Name: Hartstein

Employee Name: Fay