I have an Entity A that has a many to many association with Entity B. Something like this:
Code:
<class name="com.test.A" table="T_A">
<id name="id" column="A_ID" unsaved-value="null">
<generator class="increment"/>
</id>
<property name="name" column="A_NAME" not-null="true"/>
<set name="collectionB" table="T_A_B" cascade="all-delete-orphan">
<key column="A_ID" />
<many-to-many class="com.test.B" column="B_ID" />
</set>
</class>
<class name="com.test.B" table="T_B">
<id name="id" column="B_ID" unsaved-value="null">
<generator class="increment" />
</id>
<property name="name" column="B_NAME" not-null="true" />
<set name="collectionA" table="T_A_B" inverse="true">
<key column="B_ID" />
<many-to-many class="com.test.A" column="A_ID"/>
</set>
</class>
The schema is T_A --< T_A_B >-- T_B
I know that if I remove the T_A_B references in A instances, when I update the A the T_A_B will be deleted. But I'd like to know what I have to do to remove the B instances when yours references was removed.