Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.4
eclipselink.batch to supply EclipseLink with batching information so subsequent queries of related objects can be optimized in batches, instead of being retrieved one-by-one or in one large joined read.
This query hint accepts a single-valued, relationship path expression.
eclipselink.batch hint is more efficient than joining, because EclipseLink avoids reading duplicate data.
You can only batch queries that have a single object in the select clause.
Valid values: a single-valued relationship path expression.
Use dot notation to access nested attributes. For example, to batch-read an employee's manager's address, use
Example 4-1 shows how to use this hint in a JPA query.
Example 4-1 Using batch in a JPA Query
import org.eclipse.persistence.config.HintValues; import org.eclipse.persistence.config.QueryHints; query.setHint("eclipselink.batch", "e.address");
Example 4-2 shows how to use this hint with the
Example 4-2 Using batch in a @QueryHint Annotation
import org.eclipse.persistence.config.HintValues; import org.eclipse.persistence.config.QueryHints; @QueryHint(name=QueryHints.BATCH, value="e.address");
For more information, see:
"EclipseLink" JPA Query Hints
"Querying" in Solutions Guide for EclispeLink