Hello,
I am using H3, and I have a problem with cascade: here is my mapping documents:
I am storing class Node in table NODE, and in table REF, I have references
to class Node, as source and target. everything works well, I can save, load, etc nicely, but I can not delete, although I set cascade="delete" on my Ref class.
I made a small experiment, I opened the table REF in my database utility, and changed the foreign keys for SOURCE and TARGET to cascade, then I was able to delete. Schema export somehow does not honor the cascade="delete" statement.
Please notice I am not using a collections mapping scheme.
Thanks in advance.
-O.B.
<hibernate-mapping>
<class name="Node" table="NODE" schema="BASE">
<id name="vid" type="long">
<generator class="sequence" />
</id>
<property name="data" type="java.lang.Integer">
<column name="DATA" not-null="true" sql-type="NUMBER" />
</property>
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="Ref" table="REF" schema="BASE">
<id name="eid" type="long">
<generator class="sequence" />
</id>
<many-to-one name="source" class="Node" column="SOURCE" cascade="delete" not-null="true"/>
<many-to-one name="target" class="Node" column="TARGET" cascade="delete" not-null="true"/>
<property name="weight" type="java.lang.Double">
<column name="Weight" not-null="true" sql-type="NUMBER" />
</property>
</class>
</hibernate-mapping>
|