"enable_lazy_load_no_trans=true" creates new instance of parent in each child

Hi forum,
I am in the process of converting an application from Eclipselink to Hibernate and therefore have to use lazy reloading of detached entities first.
enable_lazy_load_no_trans = true should take care of this (although I know it’s a performance issue - which would be ok for now).
But I have the following problem, which is why the feature seems useless:

I have lazy one-to-many relation e.g. List order.items and inverse many-to-one relation Item.order.

For a detached order, when the PersistentBag for order.tems is loaded from the database, each item gets its parent order loaded from the database resulting in new instances of order in each item. All these instances have the same @Id and content.

Any ideas what I am doing wrong or how to work around this issue? (EclipseLink handles this perfectly btw.)

Thanks and regards
Rolf

That sounds like a bug to me. Please try to create a reproducer with our test case template and if you are able to reproduce the issue, create a bug ticket in our issue tracker and attach that reproducer.

1 Like

Hi Christian,

I have written a reproducer that reproduces the bug, that is that runs “green” because of the bug and will fail after the bug is fixed.
Is this the semantic that is expected?

Thanks & best,
Rolf

No, the expectation is that you show a test that fails.

1 Like

HHH-18782 opened, issue tracked there and I close here.

1 Like