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                  [EMAIL PROTECTED] Engineering GmbH
mailto:[EMAIL PROTECTED]        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:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!

Reply via email to