Hibernate updates many-to-many unnecessary

I am using Hibernate 3.2, and I have this connection between my classes:

Class B m:m Class A m:m Class C 

In one of my methods for class A, I'm going to update the many-to-many relationship with class C, so I call this first to associate the object with the session:

 super.getHibernateTemplate().update(obj); 

However, when I call it, it also updates the many-to-many relationship that the object has with class B:

 Hibernate: delete from AB_JOIN_TABLE where KEY_A=? Hibernate: insert into AB_JOIN_TABLE (KEY_A, KEY_B) values (?, ?) 

I find this completely unnecessary. I have a cascade = no on either side of the relationship A A B. I thought that would be enough. What else do I need to do?

+4
source share
1 answer

Your problem is probably caused by using a list instead of Set, as ndtreviv said.

0
source

All Articles