Code:
<hibernate-mapping>
<class name="Document" table="document">
......
<join table="Document_Meta" optional="true" >
<key column="Document_Id" />
<many-to-one name="meta" column="Meta_Id" not-null="true" unique="true" cascade="all-delete-orphan" />
</join>
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="Meta" table="meta">
<id name="id" type="int">
<column name="Id" />
<generator class="identity" />
</id>
<set name="articles" cascade="all,delete-orphan" fetch="join">
<key column="Meta_Id" />
<one-to-many class="Article" />
</set>
..........
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="Article" table="article">
<id name="id" type="int">
<column name="Id" />
<generator class="identity" />
</id>
<many-to-one class="Meta" name="meta" update="false" insert="false" />
</class>
</hibernate-mapping>
When I delete a document I would like to delete the associated meta and article(s). How would I go about doing this? Right now it just deletes the
entry in the join table Document_Meta and keeps the rows in Meta and Article.