Oracle® Application Server TopLink Mapping Workbench User's Guide
10g Release 2 (10.1.2) Part No. B15900-01 |
|
Previous |
Next |
Example 6-4 Query Optimization Using Joining
The following code example illustrates using joining for query optimization.
// Queries for Employee are configured to always join Address OneToOneMapping addressMapping = new OneToOneMapping(); addressMapping.setReferenceClass(Address.class); addressMapping.setAttributeName("address"); addressMapping.useJoining(); addressMapping.privateOwnedRelationship();
Example 6-5 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();