com.holonplatform.core.datastore.relational

## Interface SubQuery<T>

- Type Parameters:
    `T` - the type of the selection
  All Superinterfaces:
    DataTarget.DataTargetSupport<SubQuery<T>>, Expression, ExpressionResolver.ExpressionResolverBuilder<SubQuery<T>>, QueryAggregation.QueryAggregationSupport<SubQuery<T>>, QueryBuilder<SubQuery<T>>, QueryExpression<T>, QueryFilter.QueryFilterSupport<SubQuery<T>>, QuerySort.QuerySortSupport<SubQuery<T>>

      public interface SubQuery<T>
      extends QueryBuilder<SubQuery<T>>, QueryExpression<T>

  Relational sub query `QueryExpression`.

  This class implements `QueryBuilder` to build sub query using `QueryFilter`s, `QuerySort`s and providing `ExpressionResolver` registration support.

  Since:
    5.0.0

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.holonplatform.core.Expression

      `Expression.ExpressionResolverFunction<E extends Expression,R extends Expression>, Expression.InvalidExpressionException`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static SubQuery<Integer>` | `create(Datastore datastore)` Build a sub query with default `select 1` projection as selection.
    `static <T> SubQuery<T>` | `create(Datastore datastore, Class<? extends T> selectionType)` Build a sub query with given selection type.
    `static <T> SubQuery<T>` | `create(Datastore datastore, QueryProjection<T> selection)` Build a sub query with given property as selection.
    `QueryFilter` | `exists()` Build a EXISTS filter predicate using this sub query
    `QueryProjection<T>` | `getSelection()` Gets the projection to use as the subquery result
    `QueryFilter` | `notExists()` Build a NOT EXISTS filter predicate using this sub query
    `SubQuery<T>` | `select(QueryProjection<T> projection)` Specify the projection to use as the subquery result.

    - ### Methods inherited from interface com.holonplatform.core.query.QueryBuilder

      `getQueryConfiguration, limit, offset, parameter, restrict`

    - ### Methods inherited from interface com.holonplatform.core.query.QueryFilter.QueryFilterSupport

      `filter`

    - ### Methods inherited from interface com.holonplatform.core.query.QuerySort.QuerySortSupport

      `sort`

    - ### Methods inherited from interface com.holonplatform.core.datastore.DataTarget.DataTargetSupport

      `target, target`

    - ### Methods inherited from interface com.holonplatform.core.query.QueryAggregation.QueryAggregationSupport

      `aggregate, aggregate, aggregate`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverBuilder

      `withExpressionResolver`

    - ### Methods inherited from interface com.holonplatform.core.query.QueryExpression

      `getType`

    - ### Methods inherited from interface com.holonplatform.core.Expression

      `validate`

- - ### Method Detail

    - #### select

          SubQuery<T> select(QueryProjection<T> projection)

      Specify the projection to use as the subquery result.
      Parameters:
        `projection` - Projection (not null)
      Returns:
        this

    - #### getSelection

          QueryProjection<T> getSelection()

      Gets the projection to use as the subquery result
      Returns:
        Selection projection

    - #### exists

          QueryFilter exists()

      Build a EXISTS filter predicate using this sub query
      Returns:
        Exist filter

    - #### notExists

          QueryFilter notExists()

      Build a NOT EXISTS filter predicate using this sub query
      Returns:
        Not exists filter

    - #### create

          static <T> SubQuery<T> create(Datastore datastore,
                                        Class<? extends T> selectionType)

      Build a sub query with given selection type.
      Type Parameters:
        `T` - Subquery selection type
      Parameters:
        `datastore` - Datastore (not null)
        `selectionType` - Sub query selection type (not null)
      Returns:
        Sub query instance

    - #### create

          static <T> SubQuery<T> create(Datastore datastore,
                                        QueryProjection<T> selection)

      Build a sub query with given property as selection.
      Type Parameters:
        `T` - Subquery selection type
      Parameters:
        `datastore` - Datastore (not null)
        `selection` - Query selection (not null)
      Returns:
        Sub query instance

    - #### create

          static SubQuery<Integer> create(Datastore datastore)

      Build a sub query with default `select 1` projection as selection.
      Parameters:
        `datastore` - Datastore (not null)
      Returns:
        Sub query instance

Copyright © 2017 The Holon Platform. All rights reserved.