db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Bouschen <mbo.t...@spree.de>
Subject Re: Issue 147: Unique deletion by query
Date Tue, 29 Nov 2005 12:35:00 GMT
Hi Wes,

I agree, +1 for the exception.

Regards Michael

> Craig,
> 
> I favor the exception for this case.  The way we've defined setUnique, 
> it acts somewhat like an assertion, and the semantic should remain the 
> same for both execute and delete.
> 
> Regards,
> 
> Wes
> 
> 
> Craig L Russell wrote:
> 
>> Hi Michael,
>>
>> Sounds good.
>>
>> I was thinking some more about this issue and would like some feedback.
>>
>> I think that we should make the query.execute and 
>> query.deletePersistentAll methods as similar as possible, meaning that 
>> they  both should throw an exception if the cardinality of the results 
>> is not zero or one.
>>
>> I'll have a proposed wording for the specification later, but for now 
>> let's go with the patch.
>>
>> Thanks,
>>
>> Craig
>>
>> On Nov 28, 2005, at 5:35 AM, Michael Watzek wrote:
>>
>>> Hi Craig,
>>>
>>> I have added a second patch to JDO-166. It adds a unique query to the 
>>> array of INVALID_QUERIES which is supposed to throw a 
>>> JDOUserException at deletePersistentAll because the number of 
>>> affected rows in the database exceeds 1.
>>>
>>> Regards,
>>> Michael
>>>
>>>> Hi Michael,
>>>> I'd expect a JDOUserException to be thrown.
>>>> The spec says
>>>> <spec 14.6.11>
>>>> void setUnique(boolean unique);
>>>> A14.6.11-1 [When the value of the Unique flag is true, then the  
>>>> result of a query is a single value, with null used to indicate 
>>>> that  none of the instances in the candidates satisfied the filter. 
>>>> If more  than one instance satisfies the filter, and the range is 
>>>> not limited  to one result, then execute throws a JDOUserException.]
>>>> </spec 14.6.11>
>>>> I can add a similar description to the deletePersistentAll methods.  
>>>> It might require the JDOUserException to be thrown before actually  
>>>> deleting anything (the semantics of the method are such that a 
>>>> select  needs to be executed against the datastore anyway before the 
>>>> delete  occurs).
>>>> Another alternative is to disallow the Unique flag for  
>>>> deletePersistentAll. But that's not what I would choose.
>>>> Craig
>>>> On Nov 25, 2005, at 6:07 AM, Michael Watzek wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have a question concerning unique deletion by query:
>>>>>
>>>>> Assuming a unique JDO query would throw a JDOUserException in  
>>>>> execute() because the result is not unique, would you expect a  
>>>>> JDOUserException thrown in deletePersistentAll()?
>>>>>
>>>>> The spec does not require this and I'm not sure if we should add a  
>>>>> negative test case checking this.
>>>>>
>>>>> Regards,
>>>>> Michael
>>>>>
>>


-- 
Michael Bouschen		Tech@Spree Engineering GmbH
mailto:mbo.tech@spree.de	http://www.tech.spree.de/
Tel.:++49/30/235 520-33		Buelowstr. 66			
Fax.:++49/30/2175 2012		D-10783 Berlin			

Mime
View raw message