EJBQL queries may specify one or more join fetch declarations, which allow the query to specify which fields in the returned instances will be pre-fetched.
select x from Magazine x join fetch x.articles where x.title = 'JDJ'
The query above returns Magazine instances and guarantees that the articles field will already be fetched in the returned instances.
Multiple fields may be specified in separate join fetch declarations:
select x from Magazine x join fetch x.articles join fetch x.authors where x.title = 'JDJ'
![]() | Note |
|---|---|
Specifying the join fetch declaration is functionally equivalent to adding the fields to the Query's FetchConfiguration. See Section 5.6, “Fetch Groups”. | |