-->
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: Enable Cascade - On delete set null
PostPosted: Fri Mar 05, 2010 12:41 pm 
Newbie

Joined: Fri Mar 05, 2010 12:25 pm
Posts: 4
Hi everyone!

Is it possible to set a cascade type on a Collection to set child field to null when a parent is deleted. I'll give you an example.

I get two object : «Classification» and «Taxo». Classification is the parent and Taxo, the child. A Taxo don't have to get any Classification. (so it's a "not-null=false").

My mapping is ok and everyting works just fine. Except when I try to delete a Classification that get some child, the child field are not set to null. They always keep the classification ID. So my application doesn't work at all.

Code:
<set name="taxo" inverse="true" lazy="true" table="taxo" fetch="select" cascade="don't_know_what">
    <key>
        <column name="id_classification" />
    </key>
    <one-to-many class="ca.ogsl.SpeciesGuide.hibernate.Taxo" />
</set>


Is it possible to set a cascade type to avoid the fact of change all child field value to null manually before to delete the parent?

Thanks a lot for the answer!!
Kev


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.