Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

A different object with the same identifier value was already associated with the session error

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my Spring hibernate application, When I try to insert same data twice throws above error.
In here I have 2 Entity classes organisation and division, mapped with 1:M relationship.
To save Org and division I used 2 UI's,1st save the orgs and then those orgs are load into drop down in division insert ui. So in there when I save for 1st time its work fine.But the 2nd attempt with the same data gives above error.I used sequence properly.
Divition add method :


Organisation Entity :


Divition Entity :

My DAO save method Use saveorupdate.(I tried merge it didn't work either)
Anyone who knows what went wrong in code?
 
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
Please post the entire exception stacktrace.
 
reply
    Bookmark Topic Watch Topic
  • New Topic