-->
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.  [ 5 posts ] 
Author Message
 Post subject: cascade="all-delete-orphan" problem
PostPosted: Thu May 26, 2005 12:36 pm 
Beginner
Beginner

Joined: Thu May 26, 2005 12:31 pm
Posts: 25
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:2.1.8


I'm using a one-to-one mapping between two tables.

mapping in parent table

<one-to-one
name="child"
class="Child"
outer-join="auto" cascade="all-delete-orphan"
/>

mapping in child

<one-to-one
name="parent"
class="Parent"
outer-join="auto"
constrained="true"
/>

Its throwing an exception when loads the mapping

Error parsing XML: XML InputStream(222) Attribute "cascade" with value "all-delete-orphan" must have a value from the list "none all save-update delete ".

Please help.

do i need to set any thing else to use all-delete-orphan.

My requirement is to delete the child when i set the child as null in parent and save the parent.


Top
 Profile  
 
 Post subject: Re: cascade="all-delete-orphan" problem
PostPosted: Thu May 26, 2005 2:11 pm 
Regular
Regular

Joined: Thu May 26, 2005 2:08 pm
Posts: 99
soorajm wrote:
do i need to set any thing else to use all-delete-orphan.


Try "all,delete-orphan" instead.


Top
 Profile  
 
 Post subject: Re: cascade="all-delete-orphan" problem
PostPosted: Thu May 26, 2005 2:16 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
jdl wrote:
soorajm wrote:
do i need to set any thing else to use all-delete-orphan.


Try "all,delete-orphan" instead.


Are you sure you're using v2.1.8 ?

The value "all-delete-orphan" is correct under that version. The cascade values were changed in v3.0.x.

And delete-orphan is for deleting ALL of the children in the event you delete the parent. You know, deleting children that would otherwise be orphaned.


Actually, now that I realize it's a <one-to-one> mapping, you just need to specify cascade="delete" or cascade="all" to ensure the child is deleted.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 26, 2005 3:11 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
all-delete-orphan is supported in both HB3 and HB3.

However, there is no support for orphan delete for one-to-one (cannot be implemented).


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 26, 2005 3:42 pm 
Beginner
Beginner

Joined: Thu May 26, 2005 12:31 pm
Posts: 25
Thanks for the replies..

If orphan delete is not supported for one-to-one mapping, is there any other work around solution to implement the same..

I tried with "all" option, but its not deleting child table.

even though its a one-to-one map child table, can i map it as "set" and achieve the same?


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

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.