ekun (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5c2a7fd...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMjQ1MTY4MzBi...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-15449?atlOrigin=eyJpIjoiMjQ1MT...
) HHH-15449 (
https://hibernate.atlassian.net/browse/HHH-15449?atlOrigin=eyJpIjoiMjQ1MT...
) @ManyToOne associations not loaded correctly with default EAGER and batch fetch property
set when using TypedQuery.resultStream (
https://hibernate.atlassian.net/browse/HHH-15449?atlOrigin=eyJpIjoiMjQ1MT...
)
Issue Type: Bug Affects Versions: 6.1.2 Assignee: Unassigned Attachments:
hibernate-test-case-eager-regression.zip Components: hibernate-core Created: 16/Aug/2022
04:00 AM Environment: As per hibernate test case template attached
Hibernate 5.6.9, 6.1.2 Labels: regression Priority: Major Reporter: ekun (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5c2a7fd...
)
When the following propert is set in persistence.xml to a value greater than 1
<property name="hibernate.default_batch_fetch_size" value="2"
/>
Then,
In a graph with a Parent-Child relationship, where the Child has a @ManyToOne to Parent
entity, with default fetch EAGER. Then when hibernate-test-case-eager-regression.zip (
https://hibernate.atlassian.net/secure/attachment/50044/50044_hibernate-t...
) Child entities are loaded by an HQL query using the resultStream method, the parent
entity is not mapped on any of the elements returned to the stream.
See attached test case proving the way it worked in Hibernate 5, and the subsequent fault
in 6.
Workaround 1: Switch to @ManyToOne(fetch=FetchType.LAZY)
(
https://hibernate.atlassian.net/browse/HHH-15449#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15449#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#100204- sha1:f005d5a )