[ 
https://issues.apache.org/jira/browse/JDO-758?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15696388#comment-15696388
 ] 

Craig L Russell commented on JDO-758:
-------------------------------------

This part of the specification needs some work:

A14.6.2-50[The Query parameter instance is unmodified as a result of the 
addSubquery or subsequent execution of the outer Query. Only some of the 
parameter query parts are copied for use as the subquery. The parts copied 
include the candidate class, filter, parameter declarations, variable 
declarations, imports, ordering specification, uniqueness, result 
specification, and grouping specification. The association with a 
PersistenceManager, the candidate collection or extent, result class, and range 
limits are not used. ]

We also need to specify what kinds of subqueries are supported. Subqueries that 
return aggregates are required to be supported. Subqueries that return 
collections or individual objects are not required to be supported. No method 
calls on results of subqueries.


> What can a subquery return?
> ---------------------------
>
>                 Key: JDO-758
>                 URL: https://issues.apache.org/jira/browse/JDO-758
>             Project: JDO
>          Issue Type: Improvement
>          Components: specification
>    Affects Versions: JDO 3.1
>            Reporter: Tilmann Zäschke
>            Priority: Minor
>             Fix For: JDO 3.2
>
>
> The current spec specifies that subqueries should support ordering and 
> grouping, suggesting that subqueries should be able to return collections of 
> results.
> However, a  Java {{Collection}} (others are not supported in JDOQL) only 
> support {{size()}}, {{isEmpty()}} and {{contains()}}. These three functions 
> all return scalars, furthermore, these could all be implemented easily with 
> an additional term inside the subquery. Since the current reference 
> implementation does not support all these functions, it should be considered 
> whether subqueries should at all be required to return collections of objects.
> A similar argument could be made for returning persistent objects from 
> subqueries (suggested by required support for 'unique'). Persistent objects 
> cannot be used in the parent query, except for accessing their identity, or 
> possibly casting them to a persistent type and access a field.
> Can anyone think of a usecase or other argument why subqueries should be able 
> to return anything else than scalars/boolean (and possibly single persistent 
> objects)?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to