Hibernate version: 3.2.4
Database: Oracle 10
Mapping document:
Code:
<hibernate-mapping>
<class name="PersistentClass"
table="TEST_PERSISTENT_CLASS">
<id name="id"
column="PERSISTENT_CLASS_ID">
<generator class="native" />
</id>
<property name="fieldA"
type="string"
column="FIELD_A"/>
<set name="fieldD" table="TEST_PERSISTENT_CLASS_FIELD_D">
<key column="PERSISTENT_CLASS_ID" on-delete="cascade"/>
<element type="string" column="FIELD_D_VALUE" not-null="true" />
</set>
</class>
</hibernate-mapping>
Hello,
I'd like to do a bulk delete for the previous mapping.
To do this, at the database level, I need to set an ON DELETE CASCADE constraint on the PERSISTENT_CLASS_ID foreing key.
That's why I added the on-delete="cascade" attribute on the key of the 'fieldD' property
If I export the schema using the hbm2dll tool, the SQL script generated is correct and the ON DELETE CASCADE constraint is set.
Unfortunately, when I launch my application, I get the following exception :
Code:
only inverse one-to-many associations may use on-delete="cascade" : PersistentClass.fieldD
If I add the inverse attribute to the set, the result is the same.
Is there a way to get a simple (I mean without a one-to-many relationship) set (or map, that's the same problem) property working for a bulk delete?
Thank you