Yoann Rodière (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiOGIxZjAxMjBi...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-17075?atlOrigin=eyJpIjoiOGIxZj...
) HHH-17075 (
https://hibernate.atlassian.net/browse/HHH-17075?atlOrigin=eyJpIjoiOGIxZj...
) Lazy loading of association with non-PK referencedColumnName always yields null when
bytecode enhancement is enabled (
https://hibernate.atlassian.net/browse/HHH-17075?atlOrigin=eyJpIjoiOGIxZj...
)
Issue Type: Bug Assignee: Unassigned Components: hibernate-core Created: 14/Aug/2023 02:40
AM Fix Versions: 6.3.0, 6.2.8 Priority: Major Reporter: Yoann Rodière (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
With the model below, and with bytecode enhancement enabled, calling
EntityB#getMyAssociation will always yield a null value, even if the association is
supposedly non-`null`.
I’ll send a PR with a reproducer.
@Entity(name = "entitya")
public static class EntityA {
@Id
private Integer id;
@Column(unique = true)
private String myUniqueKey;
protected EntityA() {
}
public EntityA(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getMyUniqueKey() {
return myUniqueKey;
}
public void setMyUniqueKey(String myUniqueKey) {
this.myUniqueKey = myUniqueKey;
}
}
@Entity(name = "entityb")
public static class EntityB {
@Id
private Integer id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "myForeignKey", referencedColumnName =
"myUniqueKey")
private EntityA myAssociation;
protected EntityB() {
}
public EntityB(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public EntityA getMyAssociation() {
return myAssociation;
}
public void setMyAssociation(EntityA myAssociation) {
this.myAssociation = myAssociation;
}
}
(
https://hibernate.atlassian.net/browse/HHH-17075#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-17075#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#100234- sha1:d099d86 )