Oracle TopLink Developer's Guide
10g Release 3 (10.1.3) B13593-01 |
|
![]() Previous |
![]() Next |
In TopLink, object relationships can be either private or independent.
In a private relationship, the target object is a private component of the source object. The target object cannot exist without the source and is accessible only through the source object. Destroying the source object will also destroy the target object.
In an independent relationship, the source and target objects are public ones that exist independently. Destroying one object does not necessarily imply the destruction of the other.
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.
Table 35-8 Mapping Support for Private or Independent Relationships
To create a privately owned mapping, use this procedure:
Select the mapped attribute in the Navigator. Its properties appear in the Editor.
Click the General tab. The General tab appears.
Figure 35-8 General tab, Private Owned option
To create private ownership, select the Private Owned option.
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.