db-jdo-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: Issue 147: Unique deletion by query
Date Mon, 28 Nov 2005 16:33:57 GMT
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 Watzek                  Tech@Spree Engineering GmbH
>>> mailto:mwa.tech@spree.de        Buelowstr. 66
>>> Tel.:  ++49/30/235 520 36       10783 Berlin - Germany
>>> Fax.:  ++49/30/217 520 12       http://www.spree.de/
>>> -------------------------------------------------------------------
>> Craig Russell
>> Architect, Sun Java Enterprise System http://java.sun.com/products/ 
>> jdo
>> 408 276-5638 mailto:Craig.Russell@sun.com
>> P.S. A good JDO? O, Gasp!
>
>
> -- 
> -------------------------------------------------------------------
> Michael Watzek                  Tech@Spree Engineering GmbH
> mailto:mwa.tech@spree.de        Buelowstr. 66
> Tel.:  ++49/30/235 520 36       10783 Berlin - Germany
> Fax.:  ++49/30/217 520 12       http://www.spree.de/
> -------------------------------------------------------------------

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message