You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Aaron Longwell <li...@newmedialogic.com> on 2003/07/15 18:25:37 UTC
Cascading Delete
I've looked through the docs for this, but they are, forgive me, rather
unclear.
I have an m:n relationship of Bands and Performances.
I want a cascading delete to occur so that whenever the Band is deleted,
it's corresponding performances are also deleted.
However, when a performance is deleted, I do not want the corresponding
Band to be deleted because that Band may have other performances.
My Band class-descriptor has a collection descriptor called
performances.... do I put the auto-delete here? Do I need to put an
auto-delete anywhere on the performance? I am unclear as to whether the
auto-delete attribute says, delete the class-descriptor which contains
this attribute when this reference is deleted.... or if it says, delete
this reference if the class-descriptor containing it is deleted.
Thanks for the help,
Aaron
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Cascading Delete
Posted by Aaron Longwell <li...@newmedialogic.com>.
Thomas Mahler wrote:
> Hi Aaron,
>
> Aaron Longwell wrote:
>
>> I've looked through the docs for this, but they are, forgive me,
>> rather unclear.
>>
>> I have an m:n relationship of Bands and Performances.
>>
>> I want a cascading delete to occur so that whenever the Band is
>> deleted, it's corresponding performances are also deleted.
>>
>> However, when a performance is deleted, I do not want the
>> corresponding Band to be deleted because that Band may have other
>> performances.
>>
>> My Band class-descriptor has a collection descriptor called
>> performances.... do I put the auto-delete here?
>
>
> Yes.
I have set this up... and it is not deleting the records. Oddly, if I do
it the other way around, where I put auto-delete on my performance
object's reference to the band, then deleting that performance also
deletes it's corresponding band. In other words, auto-delete is working
from the n side, but not the 1 side.... Auto-Delete is working for
reference descriptors but not collection descriptors.
As a workaround, I am manually deleting the performances by doing a
deleteByQuery before doing a delete.
>
>
>> Do I need to put an auto-delete anywhere on the performance?
>
> No.
>
>> I am unclear as to whether the auto-delete attribute says, delete the
>> class-descriptor which contains this attribute when this reference is
>> deleted.... or if it says, delete this reference if the
>> class-descriptor containing it is deleted.
>
>
> auto-delete="true" on a reference- or collection-descriptor says:
> if an instance of this class is deleted, also delete the referenced
> object(s) defined by the reference- or class-descriptor.
>
> cheers,
> Thomas
>
>>
>> Thanks for the help,
>> Aaron
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Cascading Delete
Posted by Thomas Mahler <th...@web.de>.
Hi Aaron,
Aaron Longwell wrote:
> I've looked through the docs for this, but they are, forgive me, rather
> unclear.
>
> I have an m:n relationship of Bands and Performances.
>
> I want a cascading delete to occur so that whenever the Band is deleted,
> it's corresponding performances are also deleted.
>
> However, when a performance is deleted, I do not want the corresponding
> Band to be deleted because that Band may have other performances.
>
> My Band class-descriptor has a collection descriptor called
> performances.... do I put the auto-delete here?
Yes.
> Do I need to put an
> auto-delete anywhere on the performance?
No.
> I am unclear as to whether the
> auto-delete attribute says, delete the class-descriptor which contains
> this attribute when this reference is deleted.... or if it says, delete
> this reference if the class-descriptor containing it is deleted.
auto-delete="true" on a reference- or collection-descriptor says:
if an instance of this class is deleted, also delete the referenced
object(s) defined by the reference- or class-descriptor.
cheers,
Thomas
>
> Thanks for the help,
> Aaron
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org