a different object with the same identifier value was already associated with the session
This is purely a Hibernate problem. I have one to many relationship between tables. Mapping table c contains the relations between table a and table b. When I try to save a new object in a, which has a set of b objects (All those b objects are already existing), I got an Hibernate exception saying
a different object with the same identifier value was already associated with the session: [org.grassfield.common.entity.User#4]; nested exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.grassfield.common.entity.User#4]
Seems to be quiet common issue for one to many or many to many relationship in hibernate. Need to look at it tomorrow.
Finally I found the table I have created to store the many to many relation is goofy. I removed the id column (autoincrement and PK). It resolved the issue. finally I have only two columns to store the relations.
Done!