• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

org.hibernate.NonUniqueObjectException

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic