Subquery
- Type Parameters:
<T>
- the type of the selection item.
- Super Interfaces:
AbstractQuery<T>
,CommonAbstractCriteria
,Expression<T>
,Selection<T>
,TupleElement<T>
The
Subquery
interface defines functionality that is specific to subqueries. A subquery has an expression as its selection item. - Since:
- JPA 2.0
Public Methods
This method does not cause type conversion: the runtime type is not changed. Warning: may result in a runtime failure.
- Parameters:
type
- intended type of the expression
- Return:
- new expression of the given type
- Inherited from:
Expression<T>
- Since:
- JPA 2.0
- Parameters:
parentCollection
- join object of the containing query
- Return:
- subquery join
- Since:
- JPA 2.0
- Parameters:
parentJoin
- join object of the containing query
- Return:
- subquery join
- Since:
- JPA 2.0
- Parameters:
parentList
- join object of the containing query
- Return:
- subquery join
- Since:
- JPA 2.0
- Parameters:
parentMap
- join object of the containing query
- Return:
- subquery join
- Since:
- JPA 2.0
- Parameters:
parentRoot
- a root of the containing query
- Return:
- subquery root
- Since:
- JPA 2.0
- Parameters:
parentSet
- join object of the containing query
- Return:
- subquery join
- Since:
- JPA 2.0
A true value will cause duplicates to be eliminated. A false value will cause duplicates to be retained. If distinct has not been specified, duplicate results must be retained. This method only overrides the return type of the corresponding
AbstractQuery
method. - Parameters:
distinct
- boolean value specifying whether duplicate results must be eliminated from the subquery result or whether they must be retained
- Return:
- the modified subquery.
- Since:
- JPA 2.0
- Parameters:
entityClass
- the entity class
- Return:
- query root corresponding to the given entity
- Inherited from:
AbstractQuery<T>
- Since:
- JPA 2.0
- Parameters:
entity
- metamodel entity representing the entity of type X
- Return:
- query root corresponding to the given entity
- Inherited from:
AbstractQuery<T>
- Since:
- JPA 2.0
This may be a CriteriaQuery, CriteriaUpdate, CriteriaDelete, or a Subquery.
- Return:
- the enclosing query or subquery
- Since:
- JPA 2.1
Returns empty set if the subquery has no correlated joins. Modifications to the set do not affect the query.
- Return:
- the correlated joins of the subquery
- Since:
- JPA 2.0
Returns empty list if no grouping expressions have been specified. Modifications to the list do not affect the query.
- Return:
- the list of grouping expressions
- Inherited from:
AbstractQuery<T>
- Since:
- JPA 2.0
- Return:
- having clause predicate
- Inherited from:
AbstractQuery<T>
- Since:
- JPA 2.0
AbstractQuery<?> getParent()
This must be a CriteriaQuery or a Subquery.
- Return:
- the enclosing query or subquery
- Since:
- JPA 2.0
Class<T> getResultType()
If a result type was specified as an argument to the
createQuery
or subquery
method, that type will be returned. If the query was created using the createTupleQuery
method, the result type is Tuple
. Otherwise, the result type is Object
. - Return:
- result type
- Inherited from:
AbstractQuery<T>
- Since:
- JPA 2.0
These are the roots that have been defined for the
CriteriaQuery
or Subquery
itself, including any subquery roots defined as a result of correlation. Returns empty set if no roots have been defined. Modifications to the set do not affect the query. - Return:
- the set of query roots
- Inherited from:
AbstractQuery<T>
- Since:
- JPA 2.0
- Return:
- the item to be returned in the subquery result
- Since:
- JPA 2.0
Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed. This method only overrides the return type of the corresponding
AbstractQuery
method. - Parameters:
grouping
- zero or more grouping expressions
- Return:
- the modified subquery
- Since:
- JPA 2.0
Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed. This method only overrides the return type of the corresponding
AbstractQuery
method. - Parameters:
grouping
- list of zero or more grouping expressions
- Return:
- the modified subquery
- Since:
- JPA 2.0
Replaces the previous having restriction(s), if any. This method only overrides the return type of the corresponding
AbstractQuery
method. - Parameters:
restriction
- a simple or compound boolean expression
- Return:
- the modified subquery
- Since:
- JPA 2.0
Replaces the previously added having restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed. This method only overrides the return type of the corresponding
AbstractQuery
method. - Parameters:
restrictions
- zero or more restriction predicates
- Return:
- the modified subquery
- Since:
- JPA 2.0
- Parameters:
values
- collection of values to be tested against
- Return:
- predicate testing for membership
- Inherited from:
Expression<T>
- Since:
- JPA 2.0
- Parameters:
values
- expressions to be tested against
- Return:
- predicate testing for membership
- Inherited from:
Expression<T>
- Since:
- JPA 2.0
- Parameters:
values
- expression corresponding to collection to be tested against
- Return:
- predicate testing for membership
- Inherited from:
Expression<T>
- Since:
- JPA 2.0
- Parameters:
values
- values to be tested against
- Return:
- predicate testing for membership
- Inherited from:
Expression<T>
- Since:
- JPA 2.0
boolean isDistinct()
- Return:
- boolean indicating whether duplicate query results must be eliminated
- Inherited from:
AbstractQuery<T>
- Since:
- JPA 2.0
- Return:
- predicate testing whether the expression is not null
- Inherited from:
Expression<T>
- Since:
- JPA 2.0
Replaces the previously specified selection, if any.
- Parameters:
expression
- expression specifying the item that is to be returned as the subquery result
- Return:
- the modified subquery
- Since:
- JPA 2.0
Replaces the previously added restriction(s), if any. This method only overrides the return type of the corresponding
AbstractQuery
method. - Parameters:
restriction
- a simple or compound boolean expression
- Return:
- the modified subquery
- Since:
- JPA 2.0
Replaces the previously added restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed. This method only overrides the return type of the corresponding
AbstractQuery
method. - Parameters:
restrictions
- zero or more restriction predicates
- Return:
- the modified subquery
- Since:
- JPA 2.0