I have a migration issue from hibernate 5.4.32 to hibernate 6: the properties of one of my entities are not properly set. Please find below a simplified model that reproduces this issue. So, I have Elements and Tags, as presented in the attached diagram:
- Elements have Tags in a relationship ManyToOne, fetch EAGER
- Tags have composite identifiers
- Tag may have a OneToOne relationship “linkedTag”
My sample project is using Lombok / Spring Data :
- Element:
- Tag:
- The composite key:
- The test class:
The test fails since the name property is not set on Element’s Tag. None of tag’s properties is set, except for its identifier. Few remarks:
- the issue is reproduced whether the Element identifier is composite or simple (may be Long as example)
- The OneToMany relationship to Element in Tag class may also be lazy - in my project it is actually LAZY with LazyCollection(LazyCollectionOption.FALSE)
- If I remove the “linkedTag” the issue in no longer reproduced
But if I set the “linkedTag“:
The Element’s Tag’s properties are set, but with wrong values, those of the linked Tag. I have attached the tests logs and if needed, I can also share my sample project. |