Oracle TopLink Developer's Guide
10g Release 3 (10.1.3) B13593-01 |
|
![]() Previous |
![]() Next |
If a mapping has a bidirectional relationship in which the two classes in the relationship reference each other with one-to-one mappings, then set up the foreign key information as follows:
One mapping must call the setForeignKeyFieldName
method.
The other must call the setTargetForeignKeyFieldName
method.
It is also possible to set up composite foreign key information by calling the addForeignKeyFieldName
and addTargetForeignKeyFieldName
methods. Because TopLink enables indirection by default, the attribute must be a ValueHolderInterface
.
Table 35-18 summarizes which mappings support this option.
To maintain a bidirectional relationship for a 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-18 General tab, Maintains Bidirectional Relationship option
Use this table to enter data in the following fields on the tab:
Field | Description |
---|---|
Maintains Bidirectional Relationship | Specify if TopLink should maintain the bidirectional link for this relational mapping. |
Relationship Partner | Select the relationship partner (from the list of mapped attributes of the Reference Descriptor) for this bidirectional relationship. |