Hi, While upgrading our stack to spring boot 3 which brings hibernate 6, we just noticed that a feature does not work anymore. All other features (we used) works well so far. The issue is about having an entity with a child ↔︎ parent relationship on itself (having a foreign key pointing to a primary key of another row in the same table). The problem occurs only using the ability offers by hibernate to load an entity (via hibernate session) by it natural id. It seems Hibernate try to load recursively the entity attribute which point to itself to build the right SQL query, even if this attribute is mark as Lazy resulting in the end to a java.lang.StackOverflowError. I reproduced the issue on simple project in my personal github account: https://github.com/pcavezzan/parent-child-relationship-hibernate-6 I almost to forgot to mention but the project is in Kotlin ; but for me, it is not dued to Kotlin. The entity, we’re trying to load looks like the following (you can see in the project):
Thanks a lot in advance for your help on this. |