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 with 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 I have to change lot of associations and service methods for persisting a new entity.
Any help would be greatly appreciated regarding if this is a hibernate-enhance-maven-plugin bug or if there is any issue with my test?
Please find the test
https://github.com/gubbes/hibernate-orm5-hibernate-enhance-maven-plugin-test