Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.persistence.criteria
Interface Subquery<T>

Type Parameters:
  `T` - the type of the selection item.

All Superinterfaces:
  AbstractQuery<T>, Expression<T>, Selection<T>, TupleElement<T>

    public interface Subquery<T>

extends AbstractQuery<T>, Expression<T>

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

Since:
  Java Persistence 2.0

Method Summary
`
`<X,Y> CollectionJoin<X,Y>`
` | `correlate(CollectionJoin<X,Y> parentCollection)` Create a subquery collection join object correlated to a collection join object of the enclosing query.
`
`<X,Y> Join<X,Y>`
` | `correlate(Join<X,Y> parentJoin)` Create a subquery join object correlated to a join object of the enclosing query.
`
`<X,Y> ListJoin<X,Y>`
` | `correlate(ListJoin<X,Y> parentList)` Create a subquery list join object correlated to a list join object of the enclosing query.
`
`<X,K,V> MapJoin<X,K,V>`
` | `correlate(MapJoin<X,K,V> parentMap)` Create a subquery map join object correlated to a map join object of the enclosing query.
`
`<Y> Root<Y>`
` | `correlate(Root<Y> parentRoot)` Create a subquery root correlated to a root of the enclosing query.
`
`<X,Y> SetJoin<X,Y>`
` | `correlate(SetJoin<X,Y> parentSet)` Create a subquery set join object correlated to a set join object of the enclosing query.
`Subquery<T>` | `distinct(boolean distinct)` Specify whether duplicate query results will be eliminated.
`java.util.Set<Join<?,?>>` | `getCorrelatedJoins()` Return the correlated joins of 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>` | `groupBy(java.util.List<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 as the subquery 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, getResultType, getRoots, isDistinct, subquery`

Methods inherited from interface javax.persistence.criteria.Expression
`as, in, in, in, in, isNotNull, isNull`

Methods inherited from interface javax.persistence.criteria.Selection
`alias, getCompoundSelectionItems, isCompoundSelection`

Methods inherited from interface javax.persistence.TupleElement
`getAlias, getJavaType`

Method Detail

### select

    Subquery<T> select(Expression<T> expression)

  Specify the item that is to be returned as the subquery result. Replaces the previously specified selection, if any.

  Parameters:
    `expression` - expression specifying the item that is to be returned as the subquery 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<T>`
  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<T>`
  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<T>`
  Parameters:
    `grouping` - zero or more grouping expressions
  Returns:
    the modified subquery

### groupBy

    Subquery<T> groupBy(java.util.List<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<T>`
  Parameters:
    `grouping` - list of 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<T>`
  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 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.

  Specified by:
    `having` in interface `AbstractQuery<T>`
  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<T>`
  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.

### correlate

    <Y> Root<Y> correlate(Root<Y> parentRoot)

  Create a subquery root correlated to a root of the enclosing query.

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

### correlate

    <X,Y> Join<X,Y> correlate(Join<X,Y> parentJoin)

  Create a subquery join object correlated to a join object of the enclosing query.

  Parameters:
    `parentJoin` - join object of the containing query
  Returns:
    subquery join

### correlate

    <X,Y> CollectionJoin<X,Y> correlate(CollectionJoin<X,Y> parentCollection)

  Create a subquery collection join object correlated to a collection join object of the enclosing query.

  Parameters:
    `parentCollection` - join object of the containing query
  Returns:
    subquery join

### correlate

    <X,Y> SetJoin<X,Y> correlate(SetJoin<X,Y> parentSet)

  Create a subquery set join object correlated to a set join object of the enclosing query.

  Parameters:
    `parentSet` - join object of the containing query
  Returns:
    subquery join

### correlate

    <X,Y> ListJoin<X,Y> correlate(ListJoin<X,Y> parentList)

  Create a subquery list join object correlated to a list join object of the enclosing query.

  Parameters:
    `parentList` - join object of the containing query
  Returns:
    subquery join

### correlate

    <X,K,V> MapJoin<X,K,V> correlate(MapJoin<X,K,V> parentMap)

  Create a subquery map join object correlated to a map join object of the enclosing query.

  Parameters:
    `parentMap` - join object of the containing query
  Returns:
    subquery join

### getParent

    AbstractQuery<?> getParent()

  Return the query of which this is a subquery.

  Returns:
    the enclosing query or subquery

### getSelection

    Expression<T> getSelection()

  Return the selection expression.

  Specified by:
    `getSelection` in interface `AbstractQuery<T>`
  Returns:
    the item to be returned in the subquery result

### getCorrelatedJoins

    java.util.Set<Join<?,?>> getCorrelatedJoins()

  Return the correlated joins of the subquery. Returns empty set if the subquery has no correlated joins. Modifications to the set do not affect the query.

  Returns:
    the correlated joins of the subquery

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD