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.2 Using the Data Control Palette to Create Master-Detail Components

JDeveloper enables you to declaratively create master-detail UI components using the Data Control Palette. The Data Control palette displays master-detail related objects in a hierarchy, where the detail object is displayed as an accessor return under the master object. In the data control, accessor returns are always detail objects in a master-detail relationship.

When creating a page that displays master-detail objects, be sure to correctly identify which object is the master and which is the detail for your particular purposes. Otherwise, you may not display the desired data. For example, if you want to display a user and all the related service requests, then `User` would be the master object. However, if you wanted to display a service request and the user to which it is assigned, then `serviceRequest` would be the master object. The detail objects displayed depend on which object is the master.

Figure 8-1 shows the Data Control Palette for the SRDemo application. Because the `serviceHistory` and `ServiceRequest` objects have a master-detail relationship, the accessor return `serviceHistoryCollection` appears under the `ServiceRequest` method return. In this case, the accessor return is a collection of service history objects related to a service request object. Method returns are always collections, but accessor returns can be collections or single objects. For more information about the icons displayed on the DCP, see Section 5.2.1, "What You See on the Data Control Palette".

Tip: By default, when data controls are created from TopLink POJOs (or session beans over POJOs), the names of accessor returns that are collections end in `Collection`. For example, `serviceHistoryCollection`.

Figure 8-1 Master-Detail Objects on the Data Control Palette

Tip: In the Data Control Palette, the attributes shared by both the master and detail objects appear under only one of the objects, not both. For example, in the SRDemo application Data Control Palette, the `srvId` attribute appears under the `ServiceRequest` master node, but not the `serviceHistoryCollection` detail node. Also, in some cases, the master collection appears as an accessor return under a detail collection. For example, in Figure 8-1, `ServiceRequest`, which is a master collection, appears as an accessor return under the `serviceHistoryCollection` node, which is a detail collection. In this case, the common attribute shared by these collections creates a recursive relationship in the data control. In most cases, you would never use the accessor return that appears as a result of such a recursion to create a UI component.