Hi,
I am using the one-to-many association between 2 classes Device and interface. One device can have many interfaces. The mapping tags for the 2 are shown below. I have inverse set to true and cascade set to all-delete-orphan. I want the interfaces to get automatcally added, updated and deleted when refrenced and derefrenced by device. Add and update are working but the interfaces are not deleting when the device doesn't reference the interface anymore. What am I missing?
In interface xml
<many-to-one name="device" class="com.c.nm.tio.deviceLayer.DeviceDB" column="device_ip" cascade="all" />
In device xml
<set name="interfaces" cascade="all-delete-orphan" inverse="true" lazy="true" table="interface_table">
<key column="device_ip" on-delete="cascade"/>
<one-to-many class="com.c.nm.tio.deviceLayer.InterfaceDB"/>
</set>
Also I don't have any interface variable in the Device object but have a device object in the interface object. Also do I have to explicitly populate the device object in interface since it doesn't seem to automatically do it.
Please let me know.
Thanks,
Son
Hibernate version: 3.0
Name and version of the database you are using:
mysql
|