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. |
|