Module storm

Interface SubqueryTemplate

All Known Subinterfaces:
ORMTemplate, QueryTemplate
All Known Implementing Classes:
ORMTemplateImpl, QueryBuilder.WhereBuilder

public interface SubqueryTemplate
SubqueryTemplate relies on preview features of the Java platform:
  • SubqueryTemplate refers to one or more preview APIs: StringTemplate.
Programs can only use SubqueryTemplate when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
The subquery template is used to construct subqueries that can be linked to the outer query.

Unlike regular queries, subqueries only select fields from the primary table; fields from nested (foreign key) records are not included. Additionally, subqueries cannot be directly built — they should be passed as a query builder object when constructing the outer query.

Since:
1.1
  • Method Details

    • subquery

      default <T extends Record> QueryBuilder<T,?,?> subquery(@Nonnull Class<T> fromType)
      Create a subquery for the given table.
      Type Parameters:
      T - the table type to select from.
      Parameters:
      fromType - the table to create the subquery for.
      Returns:
      the subquery builder.
    • subquery

      default <T extends Record, R extends Record> QueryBuilder<T,?,?> subquery(@Nonnull Class<T> fromType, @Nonnull Class<R> selectType)
      Crate a subquery for the given table and select type.
      Type Parameters:
      T - the table type to select from.
      R - the result type.
      Parameters:
      fromType - the table to create the subquery for.
      selectType - the type to select.
      Returns:
      the subquery builder.
    • subquery

      <T extends Record> QueryBuilder<T,?,?> subquery(@Nonnull Class<T> fromType, @Nonnull StringTemplatePREVIEW template)
      Create a subquery for the given table and select type using the given template.
      Type Parameters:
      T - the table type to select from.
      Parameters:
      fromType - the table to create the subquery for.
      template - the select clause template.
      Returns:
      the subquery builder.