HHH-11729 - Add clarifications in the User Guide related to how Hibernate FetchMode types translate to JPA

This commit is contained in:
EUROPE\cdhib 2017-05-03 11:55:46 +02:00 committed by Vlad Mihalcea
parent 86dd0d1278
commit ef8ebe0d42
1 changed files with 9 additions and 6 deletions

View File

@ -284,16 +284,19 @@ it allows you to fetch all the required data with a single query.
=== The `@Fetch` annotation mapping
Besides the `FetchType.LAZY` or `FetchType.EAGER` JPA annotations,
you can also use the Hibernate-specific `@Fetch` annotation that accepts one of the following `FetchMode`s:
you can also use the Hibernate-specific `@Fetch` annotation that accepts one of the following `FetchMode(s)`:
SELECT::
Use a secondary select for each individual entity, collection, or join load.
The association is going to be fetched lazily using a secondary select for each individual entity,
collection, or join load.
It's equivalent to JPA `FetchType.LAZY` fetching strategy.
JOIN::
Use an outer join to load the related entities, collections or joins.
Use an outer join to load the related entities, collections or joins when using direct fetching.
It's equivalent to JPA `FetchType.EAGER` fetching strategy.
SUBSELECT::
Available for collections only.
When accessing a non-initialized collection, this fetch mode will trigger loading all elements of all collections of the same role
for all owners associated with the persistence context using a single secondary select.
Available for collections only.When accessing a non-initialized collection,
this fetch mode will trigger loading all elements of all collections of the same role for all owners associated
with the persistence context using a single secondary select.
[[fetching-fetchmode-select]]
=== `FetchMode.SELECT`