1

Same as the title says. I met the problem. I begin a transaction and save an object twice, then I get this exception:

 "org.hibernate.NonUniqueObjectException"

And the object is not selected from db.the first save means "insert into", the second save means "update".

Today
  • 21
  • 5
  • I find the answer [Hibernate Error: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session](http://stackoverflow.com/questions/1074081/hibernate-error-org-hibernate-nonuniqueobjectexception-a-different-object-with) – Tangoo Feb 17 '16 at 07:27
  • Yeah, save() is for inserting. The javadoc says: *Persist the given **transient** instance*. Once saved, the entity becomes *attached*, and any change you make is **transparently, automatically** made persistent. Read the user guide. This is critical stuff. – JB Nizet Feb 17 '16 at 08:40
  • @JBNizet Thanks , got it. – Today Feb 17 '16 at 08:45

0 Answers0