Pro Tips to Avoid the Dreaded org.hibernate.nonuniqueobjectexception

Pro Tips to Avoid the Dreaded org.hibernate.nonuniqueobjectexception

Pro Tips to Avoid the Dreaded org.hibernate.nonuniqueobjectexception

The `org.hibernate.NonUniqueObjectException` is thrown when Hibernate tries to save lots of or replace an object that’s already related to the present session, however the object’s identifier just isn’t the identical because the one related to the session.

This may occur if you happen to attempt to save or replace an object that has been indifferent from the session, or if you happen to attempt to save or replace an object that has been loaded from the database utilizing a unique identifier.

Read more

close