-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: delete when unreferenced in one to many relationship
PostPosted: Fri Apr 08, 2005 4:46 pm 
Newbie

Joined: Fri Apr 08, 2005 4:33 pm
Posts: 3
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.