331 words

addSubquery(sub, variableDeclaration, candidateCollectionExpression, parameters) - JDO Query's method

Method
javax.jdo.Query
void addSubquery(
  Query sub,
  String variableDeclaration,
  String candidateCollectionExpression,
  String... parameters
)

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 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.
Parameters:
sub - the subquery to add to this Query
variableDeclaration - the name of the variable in the outer query to bind the results of the subquery
candidateCollectionExpression - the candidate collection of the subquery as an expression using terms of the outer query
parameters - the expressions from the outer query to bind the parameters in the subquery
Since:
JDO 2.1

This documentation page is derived (with some adjustments) from the JDO 2.2 API
and is available under the terms of the Apache License, v. 2.0.