Skip Headers
Oracle TopLink Developer's Guide
10g Release 3 (10.1.3)
B13593-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Configuring Batch Reading

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.

Using TopLink Workbench

To use batch reading in a relationship 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 37-3 General Tab, Batch Reading Option

    Description of Figure 37-3  follows
    Description of "Figure 37-3 General Tab, Batch Reading Option"

To specify that this mapping using batch reading, select the Batch Reading option.

Using Java

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();