HHH-11793 - Change docs to point out that EAGER associations cannot be turn to LAZY with entity graphs
This commit is contained in:
parent
2867e070ea
commit
6049131218
|
@ -204,8 +204,14 @@ include::{sourcedir}/GraphFetchingTest.java[tags=fetching-strategies-dynamic-fet
|
|||
|
||||
[NOTE]
|
||||
====
|
||||
Entity graphs are the way to override the EAGER fetching associations at runtime.
|
||||
With JPQL, if an EAGER association is omitted, Hibernate will issue a secondary select for every association needed to be fetched eagerly.
|
||||
Although the JPA standard specifies that you can override an EAGER fetching association at runtime using the `javax.persistence.fetchgraph` hint,
|
||||
currently, Hibernate does not implement this feature, so EAGER associations cannot be fetched lazily.
|
||||
For more info, check out the https://hibernate.atlassian.net/browse/HHH-8776[HHH-8776] Jira issue.
|
||||
|
||||
When executing a JPQL query, if an EAGER association is omitted, Hibernate will issue a secondary select for every association needed to be fetched eagerly,
|
||||
which can lead dto N+1 query issues.
|
||||
|
||||
For this reason, it's better to use LAZY associations, and only fetch them eagerly on a per-query basis.
|
||||
====
|
||||
|
||||
[[fetching-strategies-dynamic-fetching-entity-subgraph]]
|
||||
|
|
Loading…
Reference in New Issue