• Post Reply Bookmark Topic Watch Topic
  • New Topic

org.hibernate.NonUniqueObjectException  RSS feed

 
Cainiao Zou
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I didnt used the hibernate, i just use EJB3 and JBoss, i get this Exception when i try to save beans with entityManager.persisten().

Finance newFinance = new Finance(this.entityManager.find(User.class, userName), ...);
this.entityManager.persistence(newFinance);
Finance newFinance2 = new Finance(this.entityManager.find(User.class, userName), ...);
this.entityManager.persistence(newFinance2); // I GOT THE EXCEPTION HERE

the Finance and the User are entity beans, which Finance has a User property.
And i got the org.hibernate.NonUniqueObjectException a different object with the same identifier value was already associated with the session: [entities.User] when the second persistence() be called.
I search in Internet, found some solve, but they are all about Hibernate. So what should I do only with EJB3?

thanks!
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"what whynot"

Please click on the "My Private Messages" link on top of this page, for a message from JavaRanch.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!