Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Err:NonUniqueObjectException

 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Hiberante to save data to my Database , I am trying to save two objects having the same values into the database, that is i don't mind having duplicates, any time i run the code below


and the exception i am getting is



any Suggestion would be welcome
 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was able to resolve this by calling clear on the session after each save

getSession().clear
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic