I'm using Hibernate 3.2 and I have this relationship between my classes:
Class B m:m Class A m:m Class C
In one of my methods for Class A, I'm about to update an object's many-to-many relationship with Class C, so I call this first in order to associate the object with a session:
super.getHibernateTemplate().update(obj);
However, when I call this it also updates the many-to-many relationship that the object has with Class B:
Hibernate: delete from AB_JOIN_TABLE where KEY_A=?
Hibernat开发者_运维百科e: insert into AB_JOIN_TABLE (KEY_A, KEY_B) values (?, ?)
I find this completely unnecessary. I've got cascade="none" on both sides of the relationship of A<->B. I thought that would be enough. What else do I need to do?
Probably, your problem is caused by use of the List instead of Set, like ndtreviv said.
精彩评论