i have two hbm files person and event
i have declared a many-to-many relation on both files and declared inverse="true" in event.hbm.xml
every thing is working fine on Person
but in event none of these are working
if i remove inverse="true" then its working.
what actually is inverse.
It's obvious that event.setParticipants(participants) cannot trigger an insert when Event is mapped as inverse. Because Hibernate ignores changes made on that set. You can implement setParticipants(participants) like that:
So you change the list on the non-inverse-side. Hibernate should trigger the inserts then.
That exception occurs when you try to put an entity that is either in detached state or read by another session (let's say sessionA) into sessionB where it is already "known". So Hibernate cannot decide which version it should handle as current state. (Merging is the solution...)
But without seeing the complete code it's not possible to find a real solution for that particular case.