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>>, TypedExpression<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 Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static SubQuery<Integer>` | `create()` Build a sub query with a default `select 1` projection as selection.
    `static <T> SubQuery<T>` | `create(Class<? extends T> selectionType)` Build a sub query with given selection type.
    `static SubQuery<Integer>` | `create(Datastore datastore)` Deprecated. Datastore parameter is no longer required, use `create()` instead
    `static <T> SubQuery<T>` | `create(Datastore datastore, Class<? extends T> selectionType)` Deprecated. Datastore parameter is no longer required, use `create(Class)` instead
    `static <T> SubQuery<T>` | `create(Datastore datastore, QueryProjection<T> selection)` Deprecated. Datastore parameter is no longer required, use `create(QueryProjection)` instead
    `static <T> SubQuery<T>` | `create(QueryProjection<T> selection)` Build a sub query with given projection 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

      `distinct, getQueryConfiguration, limit, offset, parameter, parameter, restrict`

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

      `filter, filter, filter`

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

      `sort, sort, 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

      `between, count, eq, eq, goe, goe, gt, gt, in, in, in, isNotNull, isNull, loe, loe, lt, lt, max, min, neq, neq, nin, nin, nin`

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

      `getTemporalType, getType, isCollectionExpression, isConverterExpression`

    - ### 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(Class<? extends T> selectionType)

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

    - #### create

          static <T> SubQuery<T> create(QueryProjection<T> selection)

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

    - #### create

          static SubQuery<Integer> create()

      Build a sub query with a default `select 1` projection as selection.
      Returns:
        Sub query instance

    - #### create

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

      Deprecated. Datastore parameter is no longer required, use `create(Class)` instead
      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

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

      Deprecated. Datastore parameter is no longer required, use `create(QueryProjection)` instead
      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

          @Deprecated
          static SubQuery<Integer> create(Datastore datastore)

      Deprecated. Datastore parameter is no longer required, use `create()` instead
      Build a sub query with default `select 1` projection as selection.
      Parameters:
        `datastore` - Datastore (not null)
      Returns:
        Sub query instance

Copyright © 2019 The Holon Platform. All rights reserved.