Hi Guys,
Believe me, i've read and read and tried and tried :) Hibernate is issuing a delete to my parent Document before it issues a delete to the children Revision. Because revision has a many-to-one not-null="true" on column docId, this causing a constraint exception when the deletion is attempted with getHibernateTemplate().delete(doc) where doc is a fully initialized object + children. I've tried manually iterating and deleting the children but with no success.
How do I ensure that Hibernate deletes the Revision children first?
Snippets below with some details omitted.
Code:
<class name="Document" table="docs">
<list name="revisions" inverse="true" cascade="all-delete-orphan">
<key column="documentID" />
<list-index column="listOrder"/>
<one-to-many class="Revision" />
</list>
</class>
<class name="Revision" table="revs">
<many-to-one name="doc" column="docId" not-null="true" />
</class>