openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: [jira] Resolved: (OPENJPA-39) Cascade delete does not work with foreign key constraints
Date Tue, 12 Sep 2006 17:56:30 GMT
Hi Abe,

On Sep 12, 2006, at 9:21 AM, Abe White wrote:

>>
>>> - When you delete a parent object and the operation cascades to  
>>> children, the object-level operation order is delete parent, then  
>>> delete children.
>>
>> In my experience, the cascade should delete the children first.  
>> This solves 99% of the cascade delete issues.
>
> It seems to me you'd just have the exact same problem when forward  
> foreign keys (rather than inverse ones as in a one-many) are used.

I think that cascade delete is most commonly used where there is a  
one-to-possibly-zero relationship (with a [zero or one or many]-to- 
one on the other side). Thus, the other side has the foreign key, and  
the side with the cascade delete definition is the side with the  
existence that doesn't depend on the other side. So deleting the  
other side first usually solves the timing issues.

> Or do you mean that cascading to a collection should delete the  
> children first, but cascading through a to-one should not?

The side with the cascade delete is not the side with the foreign key  
that might be violated. So deleting the other side first should  
always work.

>>> Register now for BEA World 2006 --- See http://www.bea.com/ 
>>> beaworld<<

Thanks for the personal invitation.

Craig

> ______________________________________________________________________ 
> _
> Notice:  This email message, together with any attachments, may  
> contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and   
> affiliated
> entities,  that may be confidential,  proprietary,  copyrighted   
> and/or
> legally privileged, and is intended solely for the use of the  
> individual
> or entity named in this message. If you are not the intended  
> recipient,
> and have received this message in error, please immediately return  
> this
> by email and then delete it.

Craig Russell
clr@apache.org http://db.apache.org/jdo



Mime
View raw message