Oracle® Application Development Framework Developer's Guide 10g (10.1.3.1.0) Part Number B28967-01 |
|
|
View PDF |
JDeveloper enables you to declaratively create master-detail pages 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.
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 either collections or single objects.
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 inCollection . For example, serviceHistoryCollection . |
Tip: The master-detail hierarchy displayed in the Data Control Palette does not reflect the cardinality of the relationship (for example, one-to-many, one-to-one, many-to-many). The hierarchy simply shows which collection (the master) is being use to retrieve one or more objects from another collection (the detail). |
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 on the page.
For example, if you want to display a user and all the related expertise areas to which the user is assigned, then User
would be the master object. However, if you wanted to display an expertise area and all the users is assigned to it, then expertiseArea
would be the master object. The detail objects displayed on a page depend on which object is the master.
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, thesrvId 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, |
For more information about the icons displayed on the Data Control Palette, see Section 5.2.1, "How to Understand the Items on the Data Control Palette".