Re: PersistenceBroker.deleteByQuery(QueryByCriteria q) does not delete objects referenced by a collection-descriptor?

Danilo Tommasina <[email protected]> Thu, 13 Dec 2007 14:13:40 +0100
Newsgroups gmane.comp.jakarta.ojb.user
Organization RCS AG
Message-ID <[email protected]>
Hi,

iirc the deleteByQuery(...) method, just produces SQL that is forwarded to the database directly without any check on auto-delete settings. This method does not 
even remove deleted objects from cache.

Regards
danilo

Hiller, Frank RD-PT31 wrote:
> Hi,
> 
> no, I don't get an error. 
> When using "PersistenceBroker.deleteByQuery(QueryByCriteria q)" the
> "parent" object is deleted, not the referenced objects.
> I didn't check the OJB code, but I guess this is normal behaviour for
> "deleteByQuery".
> 
> When I read the object first with
> "PersistenceBroker.getObjectByQuery(QueryByCriteria q)" and delete the
> received object everything is fine.
> 
> Best regards.............Frank
> 
> -----Original Message-----
> From: Alessandro Colantoni [mailto:[email protected]] 
> Sent: Thursday, December 13, 2007 12:35 PM
> To: OJB Users List
> Subject: Re: PersistenceBroker.deleteByQuery(QueryByCriteria q) does not
> delete objects referenced by a collection-descriptor?
> 
> Hi,
> right, and if it is not deleted you could get run time error due to the
> FK .
> Anyway it is better you set the auto-delete to "object", that is the
> same, but "true" and "false" are deprecated .
> 
> Best regards
> Alessandro
> 
> On 12/13/07, Hiller, Frank RD-PT31 <[email protected]> wrote:
>> Hi Alessandro,
>>
>> thank you for the quick response.
>>
>> auto-delete is set to "true".
>>
>> Otherwise "PersistenceBroker.delete(obj)" wouldn't delete the 
>> referenced collections either.
>>
>> Best regards.............Frank
>>
>> -----Original Message-----
>> From: Alessandro Colantoni [mailto:[email protected]]
>> Sent: Thursday, December 13, 2007 11:53 AM
>> To: OJB Users List
>> Subject: Re: PersistenceBroker.deleteByQuery(QueryByCriteria q) does 
>> not delete objects referenced by a collection-descriptor?
>>
>> Hi,
>>
>> it depends on the auto-delete settings:
>>
>> http://db.apache.org/ojb/docu/guides/basic-technique.html#1%3A1+auto-x
>> xx
>> +setting
>>
>> http://db.apache.org/ojb/docu/guides/basic-technique.html#1%3An+auto-x
>> xx
>> +setting
>>
>> http://db.apache.org/ojb/docu/guides/basic-technique.html#m%3An+auto-x
>> xx
>> +setting
>>
>>
>> regards
>> Alessandro
>>
>>
>>
>> On 12/13/07, Hiller, Frank RD-PT31 <[email protected]>
> wrote:
>>> Hi community,
>>>
>>> I'm using PersistenceBroker of OJB1.0.3.
>>>
>>> Is it correct that "PersistenceBroker.deleteByQuery(QueryByCriteria
>> q)"
>>> does not delete objects referenced by a collection-descriptor?
>>>
>>> Whene I use
>>> (1) Object obj = PersistenceBroker.getObjectByQuery(QueryByCriteria 
>>> q)
>>> (2) PersistenceBroker.delete(obj)
>>>
>>> it works.
>>>
>>> Thanks
>>> Frank
>>>
>>>
>>> Confidentiality note:
>>> The information in this email and any attachment may contain 
>>> confidential and proprietary information of Heidelberger 
>>> Druckmaschinen AG and/or its affiliates and may be privileged or 
>>> otherwise protected from disclosure. If you are not the intended 
>>> recipient, you are hereby notified that any review, reliance or 
>>> distribution by others or forwarding without express permission is 
>>> strictly prohibited and may cause liability. In case you have 
>>> received
>>> this message due to an error in transmission, we kindly ask you to 
>>> notify the sender immediately and to delete this email and any
>> attachment from your system.
>>
>> Confidentiality note:
>> The information in this email and any attachment may contain 
>> confidential and proprietary information of Heidelberger 
>> Druckmaschinen AG and/or its affiliates and may be privileged or 
>> otherwise protected from disclosure. If you are not the intended 
>> recipient, you are hereby notified that any review, reliance or 
>> distribution by others or forwarding without express permission is 
>> strictly prohibited and may cause liability. In case you have received
> 
>> this message due to an error in transmission, we kindly ask you to 
>> notify the sender immediately and to delete this email and any
> attachment from your system.
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
> 
> 
> Confidentiality note:
> The information in this email and any attachment may contain confidential and proprietary information of Heidelberger Druckmaschinen AG and/or its affiliates and may be privileged or otherwise protected from disclosure. If you are not the intended recipient, you are hereby notified that any review, reliance or distribution by others or forwarding without express permission is strictly prohibited and may cause liability. In case you have received this message due to an error in transmission, we kindly ask you to notify the sender immediately and to delete this email and any attachment from your system.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>