Skip Headers

Oracle® Application Development Framework Developer's Guide 10g Release 3 (10.1.3) B25386-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# 8.1 Introduction to Master-Detail Relationships in ADF

In ADF, a master-detail relationship refers to two data objects in the data control hierarchy that are logically related in such a way that an instance of one object automatically contains a related instance of the other object. For example, in the SRDemo application, when a data control method returns a collection of service requests, each service-request object contains a list of related service-history objects. The service-history objects are returned by an accessor that is a child of the parent method in the data control hierarchy. Usually, a master-detail relationship in the data control is established by one or more unique attributes that both objects share or by an object hierarchy. For example, in the SRDemo application the `serviceRequest` collection and the `serviceHistoryCollection` have a master-detail relationship, because both collections contain the `svrId` attribute (the service request number). You can also have master-detail relationships between collections and single objects. For example, each object in a collection of service requests could contain a single user object to which that service request is assigned.

Tip: In TopLink and traditional relational databases master-detail relationships are called foreign-key relationships.

When objects have a master-detail relationship, you can declaratively create pages that display the data from both objects simultaneously. For example, the SRDemo application has a page that displays a service request in a form at the top of the page and its related service history in a table at the bottom of the page. This is possible because the service request and service history objects have a master-detail relationship. In this example, the service request is the master object and the service history is the detail object. The ADF iterators automatically manage the synchronization of the detail data objects displayed for a selected master data object.

Read this chapter to understand:

- Master-detail relationships in ADF

- How to identify master-detail objects on the Data Control Palette

- How to display master-detail objects in tables, forms, trees, tree tables, and inline tables

- How to display master-detail objects on different pages that are connected by a navigation component

- How ADF iterators manage the concurrency of master and detail objects

- The binding objects created when you use the Data Control Palette to create a master-detail UI component