Skip to:
Calling merge on entity with a 1-to-many fails with org.hibernate.AssertionFailure: null identifier for collection of role. Used to work in 5.x
org.hibernate.AssertionFailure: null identifier for collection of role
Reproducer based on hibernate-test-case-templates:
Original reproducer with Quarkus 3 / Hibernate 6:
Baseline with Quarkus 2 / Hibernate 5:
Entities:
Calling merge on Book without any BookNotes causes this exception:
Fixed by https://hibernate.atlassian.net/browse/HHH-18229
right, but Quarkus (and sounds like Spring Boot) instruments the entities in this manner, causing this issue.
FYI, the test case passes if you remove @RunWith(BytecodeEnhancerRunner.class)
@RunWith(BytecodeEnhancerRunner.class)
It looks like Quarkus instruments all entities to implement the following interfaces:
org.hibernate.engine.spi.ManagedEntity
org.hibernate.engine.spi.PersistentAttributeInterceptable
org.hibernate.engine.spi.ExtendedSelfDirtinessTracker
That’s why isPersistentAttributeInterceptable returns true when running in Quarkus, and false otherwise..
isPersistentAttributeInterceptable
I verified that it’s the same behavior in Quarkus 2.x and 3.x. However, it stopped working with Hibernate 6.x.
I updated the reproducer to use QuarkusLikeORMUnitTestCase
QuarkusLikeORMUnitTestCase
I added a test for RESOURCE_LOCAL as well. It works in RESOURCE_LOCAL but not in JTA mode. I can’t really simulate JTA without Quarkus.
Hibernate takes a different path in WrapVisitor.processArrayOrNewCollection
WrapVisitor.processArrayOrNewCollection
In RESOURCE_LOCAL, the call to isPersistentAttributeInterceptable evaluates to false. In JTA/Quarkus, it evaluates to true, and fails on line 127.
Calling merge on entity with a 1-to-many fails with
org.hibernate.AssertionFailure: null identifier for collection of role
. Used to work in 5.xReproducer based on hibernate-test-case-templates:
Original reproducer with Quarkus 3 / Hibernate 6:
Baseline with Quarkus 2 / Hibernate 5:
Entities:
Calling merge on Book without any BookNotes causes this exception: