batch.type

Use eclipselink.batch.type to specify the type of batch fetching the query should use for any batch-fetched relationships.

Values

Table 4-2 describes this query hint's values.

Table 4-2 Valid Values for batch.type

Value Description

JOIN

(Default) The original query's selection criteria is joined with the batch query.

EXISTS

Uses an SQL EXISTS and a sub-select in the batch query instead of a join.

IN

Uses an SQL IN clause in the batch query passing in the source object IDs.


Examples

Example 4-5 shows how to use this hint in a JPA query.

Example 4-5 Using batch.type in a JPA Query

import org.eclipse.persistence.config.HintValues;
 import org.eclipse.persistence.config.QueryHints;
 query.setHint("eclipselink.BATCH_TYPE", "EXISTS");

Example 4-6 shows how to use this hint with the @QueryHint annotation.

Example 4-6 Using batch.type in a @QueryHint Annotation

import org.eclipse.persistence.config.HintValues;
 import org.eclipse.persistence.config.QueryHints;
 @QueryHint(name=QueryHints.BATCH_TYPE, value="EXISTS");

See Also

For more information, see: