Skip Headers

# Configuring Indirection

Previous

Next

By default, when TopLink retrieves a persistent object, it retrieves all of the dependent objects to which it refers. When you enable indirection for an attribute mapped with a relationship mapping, TopLink uses an indirection object as a placeholder for the referenced object: TopLink defers reading the dependent object until you access that specific attribute. This can result in a significant performance improvement, especially if the application is interested only in the contents of the retrieved object rather than the objects to which it refers.

Oracle strongly recommends using indirection for all relationship mappings. Not only does this allow you to optimize data source access, but it also allows TopLink to optimize the unit of work processing, cache access, and concurrency.

Table: Mapping Support for Indirection summarizes which mappings support this option.

Mapping Support for Indirection

Mapping | Value Holder Indirection | Transparent Indirect Container Indirection | Proxy Indirection | Using TopLink Workbench | Using Java
--- | --- | --- | --- | --- | ---
Relational Mappings |  |  |  |  |
Direct-to-Field Mapping |  |  |  |  |
Transformation Mapping |  |  |  |  |
One-to-One Mapping |  |  |  |  |
Variable One-to-One Mapping |  |  |  |  |
One-to-Many Mapping |  |  |  |  |
Many-to-Many Mapping |  |  |  |  |
Aggregate Collection Mapping |  |  |  |  |
Direct Collection Mapping |  |  |  |  |
Direct Map Mapping |  |  |  |  |
Object-Relational Mappings |  |  |  |  |
Object-Relational Reference Mapping |  |  |  |  |
Object-Relational Nested Table Mapping |  |  |  |  |
EIS Mappings |  |  |  |  |
EIS One-to-One Mapping |  |  |  |  |
EIS One-to-Many Mapping |  |  |  |  |
XML Mappings |  |  |  |  |
XML Transformation Mapping |  |  |  |  |

In general, Oracle recommends that you use value holder indirection (see "Value Holder Indirection") for one-to-one mappings and transparent indirect container indirection (see "Transparent Indirect Container Indirection") for collection mappings. Enable indirection for transformation mappings if the execution of the transformation is a resource-intensive task (such as accessing a database, in a relational project).

When using indirection with EJB, the version of EJB and application server you use affects how indirection is configured and what types of indirection are applicable (see "Indirection and EJB").

When using indirection with an object that your application serializes, you must consider the effect of any untriggered indirection objects at deserialization time (see "Indirection, Serialization, and Detachment").

For more information, see "Indirection".