Tomas Cerskus (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5f3fc10...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMjA3YzcyYTQw...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16136?atlOrigin=eyJpIjoiMjA3Yz...
) HHH-16136 (
https://hibernate.atlassian.net/browse/HHH-16136?atlOrigin=eyJpIjoiMjA3Yz...
) LAZY @ManyToOne may break EAGER @ManyToOne when used on the same entity in a different
parent with Bytecode Enhancement (
https://hibernate.atlassian.net/browse/HHH-16136?atlOrigin=eyJpIjoiMjA3Yz...
)
Change By: Tomas Cerskus (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5f3fc10...
)
Say I have the following entities
{noformat}User {
@Id
id: String
name: String
}
Order {
@Id
id: String
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn
user: User
// Meant to be different from Order.user
// This extra field makes Hibernate use several queries when fetching which then leads to
this bug
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn
targetUser: User
@OneToMany(targetEntity=OrderItem.class, mappedBy="order",
fetch=FetchType.EAGER)
orderItems: Set<OrderItem>
}
OrderItem {
@Id
id: String
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn
order: Order
// Same as Order.user
// Note that unlike Order.user, here it is LAZY
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn
user: User
}{noformat}
Fetching a single entity works well and returns an Order with all the relationships
populated. But fetching multiple entities returns Order with Order.user not initialised.
This issue is present with - and without - bytecode enhancement.
-I’ll add a PR with a test case shortly.- - done
(
https://hibernate.atlassian.net/browse/HHH-16136#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16136#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#100214- sha1:6795dbd )