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 Lars Soltau <la...@slab.de> on 2003/03/31 09:57:43 UTC

deleteByQuery not working as expected

Greetings,

I have two classes with a 1:n relationship between them, mapped to a 
collection in the parent class. I've set the "auto-delete" attribute to 
"true" for this collection, but when I delete parent objects by query, I 
get a database exception "child record found". Is this a bug or a feature?

Lars Soltau



Re: deleteByQuery not working as expected

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi lars,

this is the expected behaviour of deleteByQuery ;)  the delete is done 
completely in the dbms, thus related objects can not be delteted before 
the parent object. deleteByQuery also does not remove deleted objects 
from the cache because it does not know which objects are affected. so 
if you want all the nice features of ojb you'll have to delete each 
object individually.
deleteByQuery is nice to delete large amounts of unrelated objects.

hth
jakob
 

Lars Soltau wrote:

> Greetings,
>
> I have two classes with a 1:n relationship between them, mapped to a 
> collection in the parent class. I've set the "auto-delete" attribute 
> to "true" for this collection, but when I delete parent objects by 
> query, I get a database exception "child record found". Is this a bug 
> or a feature?
>
> Lars Soltau
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>