-->
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: Deleting all same class children from the root
PostPosted: Thu Jan 20, 2005 7:46 am 
Newbie

Joined: Thu Jan 20, 2005 7:18 am
Posts: 1
I start to think that it's not possible at all, but I need to ask for it.
Imagine a website like DMOZ with a lot of categories each category is an instance of Category class persisted by Hibernate.
Mapping for children could looks like:
<hibernate-mapping>
<class name="com.test.Category" lazy="true" >
....
<many-to-one name="parent" column="CatParent" cascade="none" />
<set name="children" cascade="all-delete-orphan" inverse="true" lazy="true" batch-size="10">
<key column="CatParent" on-delete="cascade" />
<one-to-many class="com.test.Category" />
</set>
...
</class>
</hibernate-mapping>

I try to build several lvls tree eg Level 0, Level 1, Level 2, Level 3, Level 4 and delete Level 1 as I have used all-delete-orphan I thought that whole branch with Level 2, Level 3, Level 4 would be erased but Hibernate only did "Hibernate: delete from category where CatID=?", without deleting rest of Objects - is there any way to delete all objects starting from parent Object and traverse "down" on every child (I mean without self coding this traversing?)

Regards Lee


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.