A different object with the same identifier value was already associated with the session error
Dilshan De Silva
posted 3 years ago
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?