Skip Headers

# Aggregate Collection Mapping

Previous

Next

Aggregate collection mappings are used to represent the aggregate relationship between a single-source object and a collection of target objects. Unlike the TopLink one-to-many mappings, in which there should be a one-to-one back reference mapping from the target objects to the source object, there is no back reference required for the aggregate collection mappings, because the foreign key relationship is resolved by the aggregation.

Note: To use aggregate collections with TopLink Workbench, you must use an amendment method (see "Configuring Amendment Methods"), or manually edit the project source to add the mapping.

Although aggregate collection mappings are similar to one-to-many mappings, they are not replacements for one-to-many mappings. Use aggregate collections only in situations where the target collections are of a reasonable size and if having a one-to-one back mapping is difficult.

Because one-to-many relationships offer better performance and are more robust and scalable, consider using a one-to-many relationship rather than an aggregate collection. In addition, aggregate collections are privately owned by the source of the relationship and must not be shared or referenced by other objects.

Aggregate collections are privately owned by the source of the relationship and should not be shared or referenced by other objects.

This section describes the following:

- Aggregate Collection Mappings and Inheritance

- Aggregate Collection Mappings and EJB

- Implementing Aggregate Collection Mappings

See "Configuring a Relational Aggregate Collection Mapping" for more information.