Khurelkhuyag M. (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYmJhNzAxOWVi...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-15674?atlOrigin=eyJpIjoiYmJhNz...
) HHH-15674 (
https://hibernate.atlassian.net/browse/HHH-15674?atlOrigin=eyJpIjoiYmJhNz...
) @NamedEntityGraph not working on entity that have composite PK (
https://hibernate.atlassian.net/browse/HHH-15674?atlOrigin=eyJpIjoiYmJhNz...
)
Change By: Khurelkhuyag M. (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Loading entity the below entity with {{OrderItem.withAll}}` fetch graph is ignored. Tested
with a singular primary key. It is fine. It seems to fail only with a composite primary
key. I attached an example maven project.
{code:java}@Entity
@Table(name = "orderItem")
@IdClass(OrderItem.PK.class)
@NamedEntityGraph(
name = "OrderItem.withAll",
attributeNodes = {
@NamedAttributeNode("product"),
@NamedAttributeNode("order"),
}
)
public class OrderItem {
@Id
@ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "product_id")
private Product product;
@Id
@ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "order_id")
private Order order;
// getters, setters ommited
public static class PK implements Serializable {
private Long product;
private Long order;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PK pk = (PK) o;
return Objects.equals(product, pk.product) && Objects.equals(order, pk.order);
}
@Override
public int hashCode() {
return Objects.hash(product, order);
}
}
}{code}
(
https://hibernate.atlassian.net/browse/HHH-15674#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15674#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#100210- sha1:21ade21 )