I can't seem to get deletes to cascade to orphaned rows in an application.
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.bla.mytable.MyTableGroup" table="MYTABLEGROUP">
<id column="MYTABLEGROUPID" name="myTableGroupId" type="long">
<generator class="native" />
</id>
<version column="UPDATECOUNT" type="int" name="updateCount" />
<property column="INTERFACED" length="1" name="interfaced" not-null="true" type="yes_no" />
<many-to-one name="applyingUser" column="APPLYINGUSER" not-null="true" class="com.bla.User" />
<set name="myTableHeader" inverse="true" cascade="all-delete-orphan">
<key column="MYTABLEGROUPID" />
<one-to-many class="com.bla.mytable.MyTableHeader" />
</set>
</class>
<class name="com.bla.mytable.MyTableHeader" table="MYTABLEHEADER">
<id column="MYTABLEHEADERID" name="myTableHeaderId" type="long">
<generator class="native" />
</id>
<version column="UPDATECOUNT" type="int" name="updateCount" />
<many-to-one name="myTableGroup" column="MYTABLEGROUPID" class="com.bla.mytable.MyTableGroup" />
</class>
</hibernate-mapping>
In debug, I can see that it is running the delete properly but the Set of orphans is empty. Cascaded updates and adds work fine. The id is a java.lang.Long.
Any ideas?