Skip Headers
Oracle TopLink Developer's Guide
10g Release 3 (10.1.3)
B13593-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Configuring Private or Independent Relationships

In TopLink, object relationships can be either private or independent.


Tip:

TopLink automatically manages private relationships. Whenever an object is written to the database, any private objects it owns are also written to the database. When an object is removed from the database, any private objects it owns are also removed. Be aware of this when creating new systems, since it may affect both the behavior and the performance of your application.

Table 35-8 summarizes which mappings support this option.

Using TopLink Workbench

To create a privately owned mapping, use this procedure:

  1. Select the mapped attribute in the Navigator. Its properties appear in the Editor.

  2. Click the General tab. The General tab appears.

    Figure 35-8 General tab, Private Owned option

    Description of Figure 35-8  follows
    Description of "Figure 35-8 General tab, Private Owned option"

To create private ownership, select the Private Owned option.

Using Java

For mappings not supported in TopLink Workbench, use the independentRelationship (default), privateOwnedRelationship, and setIsPrivateOwned methods.

Example 35-9 shows how to use these methods with a class that has a privately owned attribute, phones, in a mapping.

Example 35-10 Configuring Access Method in Java

// Map the phones attribute
phonesMapping.setAttributeName("phones");
 
// Specify as privately owned
phonesMapping.privateOwnedRelationship();