Marco Belladelli (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=637b480...
) *commented* on HHH-15876 (
https://hibernate.atlassian.net/browse/HHH-15876?atlOrigin=eyJpIjoiM2RhNj...
)
Re: Fetch type eager issue on entity with @DiscriminatorValue (
https://hibernate.atlassian.net/browse/HHH-15876?atlOrigin=eyJpIjoiM2RhNj...
)
Hello Florence Watry (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=639ae0f...
) , thanks for the feedback and for the reproducer.
I went through your code and I think the problem is the type of GraphSemantic you’re
using. In your example you’re using the hint jakarta.persistence.fetchgraph which, if you
read the javadoc for GraphSemantic#FETCH , is behaving correctly:
Attributes explicitly specified using an AttributeNodes are treated as
jakarta.persistence.FetchType.EAGER and fetched via a join or subsequent
select.
*Attributes not explicitly specified* are treated as
jakarta.persistence.FetchType.LAZY and *are not fetched*.
You should try using jakarta.persistence.loadgraph ( GraphSemantic#LOAD ) which allows to
specify which attributes to eagerly load while maintaining the configured fetch type for
other attributes. Let me know if that helps.
(
https://hibernate.atlassian.net/browse/HHH-15876#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15876#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100216- sha1:3fa9804 )