I have NonUniqueObjectException thrown when upgrading my project from Hibernate 3 to Hibernate 4 5 . I created minimal Hibernate 4 5 project for testing purposes, and managed to reproduce this exception by: - having entity "Parent", and another entity "Child" that has a composite id that contains "Parent" entity - and then in the same transaction fetching a "Parent" and then fetching "Child" by composite-id with:
*(Child) session.get(Child.class, childParentPK)*
When reverting this minimal project back to Hibernate 3 the exception is gone, and it all works fine. This could be a bug in Hibernate 4 5 ?
I have attached sample project, to run it and switch between Hibernate 3/ 4 5 consult readme.txt
|