Cascade delete does not work for instrumented/enhanced entities

Description

We are in the process on migrating our app to hibernate 5 and we found an issue with cascade delete on instrumented entities.
After some more trials, it appears that this problem happens when we use annotations on the fields. When using annotations on the properties it works fine.

Note that I have tried other hibernate versions and the problem only appeared with hibernate 5.
More precisely it seems that this line in cfg\annotations\CollectionBinder.java:
binder.setLazy( collection.isLazy() );
which was added to the bind() method in hibernate 5 is related to the problem.

I have attached 2 TestCase: one that is working with annotations on the properties and one that is failing with annotations on the fields.
Note that those TestCases use instrumentation but the same problem happens with enhancement.

Environment

Starting from version 5.0.0.

Assignee

Luis Barreiro

Reporter

Juan AMAT

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure