Marco Belladelli (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=637b480...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiY2QxZDM4MmY4...
) / Improvement (
https://hibernate.atlassian.net/browse/HHH-16313?atlOrigin=eyJpIjoiY2QxZD...
) HHH-16313 (
https://hibernate.atlassian.net/browse/HHH-16313?atlOrigin=eyJpIjoiY2QxZD...
) Throw an appropriate error when a mappedBy property references the wrong entity type (
https://hibernate.atlassian.net/browse/HHH-16313?atlOrigin=eyJpIjoiY2QxZD...
)
Change By: Marco Belladelli (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=637b480...
)
We have seen multiple cases of users migrating from Hibernate 5 to 6 getting errors caused
by having an invalid mapping: entity collections annotated with a {{mappedBy}} which
references a property of a different type of the original entity. For example:
{code:java} @Entity
public static class EntityA {
@Id
private Long id;
@OneToMany( mappedBy = "three" )
private List<EntityB> twos;
}
@Entity
public static class EntityB {
@Id
private Long id;
@ManyToOne
private EntityC three;
}
@Entity
public static class EntityC {
@Id
private Long id;
}{code}
This type of mappings used to work in Hibernate 5 (with unexpected results), but in 6 it
causes errors.
We should check the {{mappedBy}} property type ahead of time and give a give a more
informative error message.
(
https://hibernate.atlassian.net/browse/HHH-16313#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16313#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#100217- sha1:fd7c927 )