Index: api2/src/java/javax/jdo/Query.java =================================================================== --- api2/src/java/javax/jdo/Query.java (Revision 590729) +++ api2/src/java/javax/jdo/Query.java (Arbeitskopie) @@ -586,6 +586,40 @@ /** * Add a subquery to this query. + * @param sub the subquery to add to this Query + * @param variableDeclaration the name of the variable in the outer query + * to bind the results of the subquery + * @param candidateCollectionExpression the candidate collection + * of the subquery as an expression using terms of the outer query + * @see #addSubquery(Query sub, String variableDeclaration, + * String candidateCollectionExpression, String... parameters) + * @since 2.1 + */ + void addSubquery + (Query sub, String variableDeclaration, + String candidateCollectionExpression); + + /** + * Add a subquery to this query. + * The String version of the method binds the named expression + * to the parameter implictly or explicitly declared in the + * subquery. + * @param sub the subquery to add to this Query + * @param variableDeclaration the name of the variable + * to be used in this Query + * @param candidateCollectionExpression the candidate collection + * to apply to the subquery + * @param parameter the actual value of the subquery parameter + * @see #addSubquery(Query sub, String variableDeclaration, + * String candidateCollectionExpression, String... parameters) + * @since 2.1 + */ + void addSubquery + (Query sub, String variableDeclaration, + String candidateCollectionExpression, String parameter); + + /** + * Add a subquery to this query. * A subquery is composed as a Query and subsequently attached * to a different query (the outer query) by calling this method. * The query parameter instance is unmodified as a result of the @@ -609,7 +643,11 @@ * outer query that represents the candidates over which the subquery * is evaluated. If the trimmed value is the empty String, or the * parameter is null, then the candidate collection is the extent - * of the candidate class. + * of the candidate class. + * The String... version of the method binds the named expressions in + * turn to parameters in the order in which they are declared in the + * subquery, or in the order they are found in the filter if not + * explicitly declared in the subquery. * @param sub the subquery to add to this Query * @param variableDeclaration the name of the variable in the outer query * to bind the results of the subquery @@ -619,6 +657,28 @@ */ void addSubquery (Query sub, String variableDeclaration, - String candidateCollectionExpression); + String candidateCollectionExpression, String... parameters); + /** + * Add a subquery to this query. + * The Map version of the method treats the key of each map entry as + * the name of the parameter in the subquery, with or without the + * leading ":", and the value as the name of the expression in the + * outer query. If the trimmed expression is the empty String for + * either the parameter or the value of the String[], or for any + * map key or value, that expression is ignored. + * @param sub the subquery to add to this Query + * @param variableDeclaration the name of the variable + * to be used in this Query + * @param candidateCollectionExpression the candidate collection + * to apply to the subquery + * @param parameters the actual values of the subquery parameters + * @see #addSubquery(Query sub, String variableDeclaration, + * String candidateCollectionExpression, String... parameters) + * @since 2.1 + */ + void addSubquery + (Query sub, String variableDeclaration, + String candidateCollectionExpression, Map parameters); + } Index: api2-legacy/src/java/javax/jdo/Query.java =================================================================== --- api2-legacy/src/java/javax/jdo/Query.java (Revision 590729) +++ api2-legacy/src/java/javax/jdo/Query.java (Arbeitskopie) @@ -586,30 +586,99 @@ /** * Add a subquery to this query. - * The query parameter instance is unmodified as a result of the - * addSubquery or subsequent execution of the outer query. - * Only some of the query parts are copied for use as the subquery. - * The parts copied include the candidate class, filter, parameter - * declarations, variable declarations, imports, ordering specification, + * @param sub the subquery to add to this Query + * @param variableDeclaration the name of the variable in the outer query + * to bind the results of the subquery + * @param candidateCollectionExpression the candidate collection + * of the subquery as an expression using terms of the outer query + * @see #addSubquery(Query sub, String variableDeclaration, + * String candidateCollectionExpression, String[] parameters) + * @since 2.1 + */ + void addSubquery + (Query sub, String variableDeclaration, + String candidateCollectionExpression); + + /** + * Add a subquery to this query. + * The String version of the method binds the named expression + * to the parameter implictly or explicitly declared in the + * subquery. + * @param sub the subquery to add to this Query + * @param variableDeclaration the name of the variable + * to be used in this Query + * @param candidateCollectionExpression the candidate collection + * to apply to the subquery + * @param parameter the actual value of the subquery parameter + * @see #addSubquery(Query sub, String variableDeclaration, + * String candidateCollectionExpression, String[] parameters) + * @since 2.1 + */ + void addSubquery + (Query sub, String variableDeclaration, + String candidateCollectionExpression, String parameter); + + /** + * Add a subquery to this query. + * A subquery is composed as a Query and subsequently attached + * to a different query (the outer query) by calling this method. + * The query parameter instance is unmodified as a result of the + * addSubquery or subsequent execution of the outer query. + * Only some of the 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, - * result class, limits on size, and number of skipped instances - * are not used. - * The variableDeclaration is the name of the variable containing - * the results of the subquery execution. This variable may be used - * in this query. - * The candidateCollectionExpression is the expression using tokens - * from this query that represent the candidates over which the - * subquery is evaluated. + * The association with a PersistenceManager, the candidate collection + * or extent, result class, and range limits are not used. + * The String parameters are trimmed of white space. + * The variableDeclaration parameter is the name of the variable + * containing the results of the subquery execution. If the same value + * of variableDeclaration is used to add multiple subqueries, the + * subquery replaces the previous subquery for the same named variable. + * If the subquery parameter is null, the variable is unset, + * effectively making the variable named in the variableDeclaration + * unbound. If the trimmed value is the empty String, or the parameter + * is null, then JDOUserException is thrown. + * The candidateCollectionExpression is the expression from the + * outer query that represents the candidates over which the subquery + * is evaluated. If the trimmed value is the empty String, or the + * parameter is null, then the candidate collection is the extent + * of the candidate class. + * The String[] version of the method binds the named expressions in + * turn to parameters in the order in which they are declared in the + * subquery, or in the order they are found in the filter if not + * explicitly declared in the subquery. * @param sub the subquery to add to this Query + * @param variableDeclaration the name of the variable in the outer query + * to bind the results of the subquery + * @param candidateCollectionExpression the candidate collection + * of the subquery as an expression using terms of the outer query + * @since 2.1 + */ + void addSubquery + (Query sub, String variableDeclaration, + String candidateCollectionExpression, String[] parameters); + + /** + * Add a subquery to this query. + * The Map version of the method treats the key of each map entry as + * the name of the parameter in the subquery, with or without the + * leading ":", and the value as the name of the expression in the + * outer query. If the trimmed expression is the empty String for + * either the parameter or the value of the String[], or for any + * map key or value, that expression is ignored. + * @param sub the subquery to add to this Query * @param variableDeclaration the name of the variable * to be used in this Query * @param candidateCollectionExpression the candidate collection * to apply to the subquery + * @param parameters the actual values of the subquery parameters + * @see #addSubquery(Query sub, String variableDeclaration, + * String candidateCollectionExpression, String[] parameters) * @since 2.1 */ void addSubquery (Query sub, String variableDeclaration, - String candidateCollectionExpression); + String candidateCollectionExpression, Map parameters); }