EclipseLink 2.0.0_ 2.0.0.v20090424-r4050 API Reference

javax.persistence.criteria
Interface Subquery<T>

Type Parameters:
T - the type of the returned selection item.
All Superinterfaces:
AbstractQuery, Expression<T>, ResultItem<T>, Selection<T>

public interface Subquery<T>
extends AbstractQuery, Expression<T>

The interface Subquery defines functionality that is specific to subqueries. A subquery has an expression as its selection item.


Method Summary
<X,Y> CollectionJoin<X,Y>
correlate(CollectionJoin<X,Y> parentCollection)
          Correlates a join to a Collection-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object.
<X,Y> Join<X,Y>
correlate(Join<X,Y> parentJoin)
          Correlates a join object of the enclosing query to a join object of the subquery and returns the subquery join object.
<X,Y> ListJoin<X,Y>
correlate(ListJoin<X,Y> parentList)
          Correlates a join to a List-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object.
<X,K,V> MapJoin<X,K,V>
correlate(MapJoin<X,K,V> parentMap)
          Correlates a join to a Map-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object.
<Y> Root<Y>
correlate(Root<Y> parentRoot)
          Correlates a root of the enclosing query to a root of the subquery and returns the subquery root.
<X,Y> SetJoin<X,Y>
correlate(SetJoin<X,Y> parentSet)
          Correlates a join to a Set-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object.
 Subquery<T> distinct(boolean distinct)
          Specify whether duplicate query results will be eliminated.
 java.util.Set<Join<?,?>> getJoins()
          Return the joins that have been made from the subquery.
 AbstractQuery getParent()
          Return the query of which this is a subquery.
 Expression<T> getSelection()
          Return the selection expression.
 Subquery<T> groupBy(Expression<?>... grouping)
          Specify the expressions that are used to form groups over the subquery results.
 Subquery<T> having(Expression<java.lang.Boolean> restriction)
          Specify a restriction over the groups of the subquery.
 Subquery<T> having(Predicate... restrictions)
          Specify restrictions over the groups of the subquery according the conjunction of the specified restriction predicates.
 Subquery<T> select(Expression<T> expression)
          Specify the item that is to be returned in the query result.
 Subquery<T> where(Expression<java.lang.Boolean> restriction)
          Modify the subquery to restrict the result according to the specified boolean expression.
 Subquery<T> where(Predicate... restrictions)
          Modify the subquery to restrict the result according to the conjunction of the specified restriction predicates.
 
Methods inherited from interface javax.persistence.criteria.AbstractQuery
from, from, getGroupList, getGroupRestriction, getRestriction, getRoots, isDistinct, subquery
 
Methods inherited from interface javax.persistence.criteria.Expression
as, getJavaType, in, isNotNull, isNull
 
Methods inherited from interface javax.persistence.criteria.Selection
setAlias
 
Methods inherited from interface javax.persistence.ResultItem
getAlias
 

Method Detail

getParent

AbstractQuery getParent()
Return the query of which this is a subquery.

Returns:
the enclosing query or subquery

select

Subquery<T> select(Expression<T> expression)
Specify the item that is to be returned in the query result. Replaces the previously specified selection, if any.

Parameters:
expression - expression specifying the item that is returned in the query result
Returns:
the modified subquery

where

Subquery<T> where(Expression<java.lang.Boolean> restriction)
Modify the subquery to restrict the result according to the specified boolean expression. Replaces the previously added restriction(s), if any. This method only overrides the return type of the corresponding AbstractQuery method.

Specified by:
where in interface AbstractQuery
Parameters:
restriction - a simple or compound boolean expression
Returns:
the modified subquery

where

Subquery<T> where(Predicate... restrictions)
Modify the subquery to restrict the result according to the conjunction of the specified restriction predicates. 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.

Specified by:
where in interface AbstractQuery
Parameters:
restrictions - zero or more restriction predicates
Returns:
the modified subquery

groupBy

Subquery<T> groupBy(Expression<?>... grouping)
Specify the expressions that are used to form groups over the subquery results. 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.

Specified by:
groupBy in interface AbstractQuery
Parameters:
grouping - zero or more grouping expressions
Returns:
the modified subquery

having

Subquery<T> having(Expression<java.lang.Boolean> restriction)
Specify a restriction over the groups of the subquery. Replaces the previous having restriction(s), if any. This method only overrides the return type of the corresponding AbstractQuery method.

Specified by:
having in interface AbstractQuery
Parameters:
restriction - a simple or compound boolean expression
Returns:
the modified subquery

having

Subquery<T> having(Predicate... restrictions)
Specify restrictions over the groups of the subquery according the conjunction of the specified restriction predicates. 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.

Specified by:
having in interface AbstractQuery
Parameters:
restrictions - zero or more restriction predicates
Returns:
the modified subquery

distinct

Subquery<T> distinct(boolean distinct)
Specify whether duplicate query results will be eliminated. 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.

Specified by:
distinct in interface AbstractQuery
Parameters:
distinct - boolean value specifying whether duplicate results must be eliminated from the subquery result or whether they must be retained
Returns:
the modified subquery.

getSelection

Expression<T> getSelection()
Return the selection expression.

Returns:
the item to be returned in the subquery result

correlate

<Y> Root<Y> correlate(Root<Y> parentRoot)
Correlates a root of the enclosing query to a root of the subquery and returns the subquery root.

Parameters:
parentRoot - a root of the containing query
Returns:
subquery root

correlate

<X,Y> Join<X,Y> correlate(Join<X,Y> parentJoin)
Correlates a join object of the enclosing query to a join object of the subquery and returns the subquery join object.

Parameters:
parentJoin - join target of the containing query
Returns:
subquery join

correlate

<X,Y> CollectionJoin<X,Y> correlate(CollectionJoin<X,Y> parentCollection)
Correlates a join to a Collection-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object.

Parameters:
parentCollection - join target of the containing query
Returns:
subquery join

correlate

<X,Y> SetJoin<X,Y> correlate(SetJoin<X,Y> parentSet)
Correlates a join to a Set-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object.

Parameters:
parentSet - join target of the containing query
Returns:
subquery join

correlate

<X,Y> ListJoin<X,Y> correlate(ListJoin<X,Y> parentList)
Correlates a join to a List-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object.

Parameters:
parentList - join target of the containing query
Returns:
subquery join

correlate

<X,K,V> MapJoin<X,K,V> correlate(MapJoin<X,K,V> parentMap)
Correlates a join to a Map-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object.

Parameters:
parentMap - join target of the containing query
Returns:
subquery join

getJoins

java.util.Set<Join<?,?>> getJoins()
Return the joins that have been made from the subquery.

Returns:
joins made from this type

EclipseLink 2.0.0_ 2.0.0.v20090424-r4050 API Reference