Hi,
You can apply the following changes to your code,
Replace
>>> a.bset.remove(b);
with
<<< session.flush() ; (1) <<< a.bset.remove(a.bset.iterator().next()) ; (2)
Reason: (2)
a = session.merge(a) ; would cascade merge to child b ( in a ).
So, the b that we have with us is no longer associated with sesssion ( and with 'a' ).
You can test this. ( a.bset.size() = 1 , even after you remove b, because they are different objects. )
Reason: (1)
I am not clear at this point of time.
I assume that transactions are in place. ( obvious, else you don't expect data to commit in database )
--------------------------------------------------------
Rate the reply if you find it helpful
|