Skip Headers
Oracle® TopLink Developer's Guide
10g (10.1.3.1.0)
B28218-01
  Go To Documentation Library
Library
Go To Product List
Product
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
 

Configuring Bidirectional Relationship

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:

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.


Note:

When your application does not use a cache, enable indirection for at least one object in a bidirectional relationship. In rare cases, disabling indirection on both objects in the bidirectional relationship can lead to infinite loops. For more information, see the following:

Table 32-18 summarizes which mappings support this option.

Table 32-19 Mapping Support for Mutable Mappings

Mapping Using TopLink Workbench
Using Java

Relational Mappings




    One-to-One Mapping


Supported.


Supported.


    One-to-Many Mapping


Supported.


Supported.


    Many-to-Many Mapping


Supported.


Supported.


EIS Mappings




    EIS One-to-One Mapping


Supported.


Supported.


    EIS One-to-Many Mapping


Supported.


Supported.



Using TopLink Workbench

To maintain a bidirectional relationship for a 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 32-20 General tab, Maintains Bidirectional Relationship option

    Description of Figure 32-20 follows
    Description of "Figure 32-20 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.