[hibernate-dev] cascading deletion issue

Teresa Batista Neto teresa.batista.neto at gmail.com
Tue Mar 5 05:24:38 EST 2013

Dear all,

I'm trying to use cascading deletion but it doesn't seem to work.

If you can guarantee that no other object (or row in any other table) holds
a reference to these bids, you can make the deletion transitive.
Hibernate (and JPA) offer a cascading option for this purpose. You can
enable cascading for the delete operation
<set name="bids" inverse="true" cascade="save-update, delete">

Only works for me if I'm mapping to a Set... If I use List it stops working
and returns java.util.ConcurrentModificationException...

Any ideas?

<class name="SimpleDatabase" table="TERM">
       <list name="optionalFields"
           cascade="save-update, delete, delete-orphan"
            <key column="TERM_ID"/>
            <list-index column="FIELD_ORDER" base="1"/>
            <one-to-many class="SimpleDatabaseOptionalField"/>

<class name="SimpleDatabaseOptionalField" table="OPTIONAL_FIELD">
        <id name="fieldId" column="FIELD_ID" type="integer">
            <generator class="sequence">
                <param name="sequence">SEQ_XREFDB</param>
        <property name="termId" column="TERM_ID" type="integer"/>
        <property name="fieldOrder" column="FIELD_ORDER" type="integer"
not-null="true" />
        <property name="description" column="DESCRIPTION" type="string"
        <property name="xmlPropertyName" column="XML_PROPERTY_NAME"
type="string" not-null="true"/>
        <property name="rdfPropertyName" column="RDF_PROPERTY_NAME"
type="string" not-null="true"/>

Thanks in advance,

More information about the hibernate-dev mailing list