Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.4
  Go To Table Of Contents
 Search
 PDFComments
Comments


left-join-fetch

Use eclipselink.left-join-fetch to optimize the query: related objects will be joined into the query instead of being queries separately.


Values

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

Table 4-22 Valid Values for left-join-fetch

Value Description

String

JPQL-style navigations to a relationship



Usage

You can use this query hint to create nested join fetches, which is not supported by JPQL. You can also use eclipselink.left-join-fetch to create join fetches with native queries.


NoteNote:

This uses an OUTER join to allow null or empty values.



Examples

Example 4-44 Using left-join-fetch in a JPA Query

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

Example 4-45 Using left-join-fetch in a @QueryHint Annotation

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


See Also