Fixed
Details
Assignee
Luis BarreiroLuis BarreiroReporter
Goutham DGoutham DLabels
Fix versions
Priority
Major
Details
Details
Assignee
Luis Barreiro
Luis BarreiroReporter
Goutham D
Goutham DLabels
Fix versions
Priority
Created October 23, 2017 at 2:15 PM
Updated December 11, 2018 at 7:55 PM
Resolved November 16, 2017 at 8:36 AM
After migrating hibernate from 4.3.11 to 5.1.10 and using the new hibernate-enhance-maven-plugin replacing the deprecated ant bytecode enhancement task, the following happens with an entity with OneToMany association and CascadeType.ALL.
enableLazyInitialization set to false and the test passes
enableLazyInitialization set to true and the test fails with "Detached entity passed to persist"
App worked fine with 4.3.11 version of hibernate and the old bytecode enhancement with ant task.
I can work around this by removing CascadeType.PERSIST but needs to modify lot of associations and the related service classes for persisting new entity.
From the debugging, I found that a Persist event triggers followed by Merge event when CascadeType.ALL is set on an association and the entities are detached when enableLazyInitialization is set to true.
Please find the test attached.