1

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 needs a work around for while persisting an 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 here

Update:

Appears to be a bug in hibernate, created the ticket, https://hibernate.atlassian.net/browse/HHH-12054

Community
  • 1
  • 1
Gubbes
  • 43
  • 6
  • _the following happens with an entity..._ only with one entity ? – pirho Oct 21 '17 at 07:28
  • No, any entity that is being lazy loaded. I think what is happening is, a merge is triggered followed by a persist and the exception happens during the persist. – Gubbes Oct 21 '17 at 14:29

0 Answers0