We're updating the issue view to help you get more done. 

Bytecode: ExtendedSelfDirtinessTracker not assigned consistently

Description

While trying to solve HHH-12425, I discovered that during bytecode enhancement, ExtendedSelfDirtinessTracker is not assigned in all cases:

As soon as a entity collection has field level access, ExtendedSelfDirtinessTracker is not implemented. When the collection is property level accessed, ExtendedSelfDirtinessTracker is implemented.

In this relation I assume that the issue is in
org.hibernate.bytecode.enhance.internal.bytebuddy.EnhancerImpl#collectCollectionFields, line 368:

1 if ( enhancementContext.isPersistentField( ctField ) && !enhancementContext.isMappedCollection( ctField ) ) {

With field level access, isMappedCollection evaluates to true, so the collection field is not added. With property level access, isMappedCollection does not evaluate to true. From my understanding, both cases should cause the collection field to be added, so ExtendedSelfDirtinessTracker has to be also implemented in both cases.

Test case: https://github.com/nikowitt/hibernate-test-case-templates/tree/HHH-12593

Environment

None

Status

Assignee

Unassigned

Reporter

Niko Wittenbeck

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.3.0.Final

Priority

Major