Rahul Babbar wrote:Yes....i think the problem is coming because you are doing
user.setMydepts(new HashSet());
According to this code, if there was anything in the original set, it should be removed....and it should be replaced by this new Set...
So, hibernate is doing what it should, remove the original records, and then add the new records...
I have not tested it, but some code like below should work.