I can't seem to get cascade deletes to work with composite-elements. The classes I have are pretty simple, yet for all configurations I try it seems to do something wrong. This is an example of the mapping that causes trouble:
Code:
<class name="com.sagebrush.pinpoint.dataobject.Configuration" table="CONFIGURATION" lazy="false">
<id name="id">
<generator class="assigned" />
</id>
... a few normal properties...
<bag name="onSiteIpMasks" table="ON_SITE_IPS" lazy="false">
<key column="configurationId" />
<composite-element class="com.sagebrush.pinpoint.dataobject.IpMask">
<property name="mask"/>
</composite-element>
</bag>
</class>
Whenever I try to remove a configuration, I get ConstraintViolationExceptions from the ON_SITE_IPS table. I tried adding cascade="all-delete-orphan", which did absolutely nothing. I tried adding inverse="true", which made the onSiteIps not to be saved anymore (even with cascade="all-delete-orphan"). I tried to add on-delete="cascade" to the key, but that's not allowed (hibernate complains about not being an inverse one-to-many).
This seems like such a simple problem yet I can't figure what's wrong. Is this a bug? Expected behaviour? If so, how do I create a managed, dependent component???
[]s Gus