Skip Headers

# Directionality

Previous

Next

The direction of a relationship may be either unidirectional or bidirectional. In a unidirectional relationship, only one entity bean has a relationship field that refers to the other. All TopLink relational mappings are unidirectional, from the class being described (the source class) to the class with which it is associated (the target class). The target class does not have a reference to the source class in a unidirectional relationship.

In a bidirectional relationship, each entity bean has a relationship field that refers to the other bean. Through the relationship field, an entity bean's code can access its related object. To implement a bidirectional relationship (classes that reference each other), use two unidirectional mappings with the sources and targets reversed.

Note:

Maintenance of bidirectional relationships presents a number of technical challenges. For more information, see the following:

- "Maintaining Bidirectional Relationships"

- "Configuring Bidirectional Relationship"

- "Indirection"