Oracle TopLink Developer's Guide
10g Release 3 (10.1.3) B13593-01 |
|
![]() Previous |
![]() Next |
Batch reading can be used in most of the relational mappings. This feature should be used only if it is known that the related objects are always required with the source object.
Table 37-7 summarizes which relational mappings support this option.
To use batch reading in a relationship 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 37-3 General Tab, Batch Reading Option
To specify that this mapping using batch reading, select the Batch Reading option.
Example 37-1 Query Optimization Using Batching
The following code example illustrates using batch for query optimization.
// Queries on Employee are configured to always batch read Address
OneToManyMapping phoneNumbersMapping = new OneToManyMapping();
phoneNumbersMapping.setReferenceClass(" PhoneNumber.class")
phoneNumbersMapping.setAttributeName("phones");
phoneNumbersMapping.useBatchReading();
phoneNumbersMapping.privateOwnedRelationship();