Hi.
I have many-to-many relationship.
Code:
class A {
Set<B> bs
}
class B {
}
<set name="bs" table="bs_tab" cascade = "save-update">
<key column="a_id />
<many-to-many column="b_id" class="B"/>
</set>
bs_tab is table(
a_id, b_id, primary key(a_id, b_id)
)
I use for A standard DAO. Problem is that when I first add some B to bs (b1) and then save A, and later I add another B (b2) and update A, b1 is deleted. I do those two operations on the same A instance. I save object calling session.saveOrUpdate(A instance). When you look at the generated sql commands it looks like hibernate is deleting all elements of bs from bs_tab before inserting new row into it. Does anyone know the solution?