Module storm.java

Class QueryTemplateImpl

java.lang.Object
st.orm.template.impl.QueryTemplateImpl
All Implemented Interfaces:
QueryTemplate, SubqueryTemplate
Direct Known Subclasses:
ORMTemplateImpl

public class QueryTemplateImpl extends Object implements QueryTemplate
QueryTemplateImpl relies on preview features of the Java platform:
  • QueryTemplateImpl refers to one or more preview APIs: StringTemplate.
Programs can only use QueryTemplateImpl when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
  • Constructor Details

    • QueryTemplateImpl

      public QueryTemplateImpl(st.orm.core.template.QueryTemplate core)
  • Method Details

    • createBindVars

      public BindVars createBindVars()
      Description copied from interface: QueryTemplate
      Create a new bind variables instance that can be used to add bind variables to a batch.
      Specified by:
      createBindVars in interface QueryTemplate
      Returns:
      a new bind variables instance.
      See Also:
    • ref

      public <T extends Data, ID> Ref<T> ref(Class<T> type, ID id)
      Description copied from interface: QueryTemplate
      Creates a ref instance for the specified record type and pk. This method can be used to generate ref instances for entities, projections and regular records.
      Specified by:
      ref in interface QueryTemplate
      Type Parameters:
      T - table type.
      ID - primary key type.
      Parameters:
      type - record type.
      id - primary key.
      Returns:
      ref instance.
    • ref

      public <T extends Data, ID> Ref<T> ref(T record, ID id)
      Description copied from interface: QueryTemplate
      Creates a ref instance for the specified record type and id. This method can be used to generate ref instances for entities, projections and regular records. The object returned by this method already contains the fetched record.
      Specified by:
      ref in interface QueryTemplate
      Type Parameters:
      T - table type.
      ID - primary key type.
      Parameters:
      id - primary key.
      Returns:
      ref instance.
    • model

      public <T extends Data, ID> Model<T,ID> model(Class<T> type)
      Description copied from interface: QueryTemplate
      Get the model for the specified record type. The model provides information about the type's database name, primary keys and columns.
      Specified by:
      model in interface QueryTemplate
      Type Parameters:
      T - table type.
      ID - primary key type.
      Parameters:
      type - record type.
      Returns:
      the model.
    • model

      public <T extends Data, ID> Model<T,ID> model(Class<T> type, boolean requirePrimaryKey)
      Description copied from interface: QueryTemplate
      Get the model for the specified record type. The model provides information about the type's database name, primary keys and columns.
      Specified by:
      model in interface QueryTemplate
      Type Parameters:
      T - table type.
      ID - primary key type.
      Parameters:
      type - record type.
      requirePrimaryKey - whether to require a primary key.
      Returns:
      the model.
    • selectFrom

      public <T extends Data, R> QueryBuilder<T,R,Object> selectFrom(Class<T> fromType, Class<R> selectType, StringTemplatePREVIEW template)
      Description copied from interface: QueryTemplate
      Creates a query builder for the specified table and select type using the given template.
      Specified by:
      selectFrom in interface QueryTemplate
      Type Parameters:
      T - the table type to select from.
      R - the result type.
      Parameters:
      fromType - the table to select from.
      selectType - the result type of the query.
      template - the select clause template.
      Returns:
      the query builder.
    • deleteFrom

      public <T extends Data> QueryBuilder<T,?,?> deleteFrom(Class<T> fromType)
      Description copied from interface: QueryTemplate
      Creates a query builder for the specified table to delete from.
      Specified by:
      deleteFrom in interface QueryTemplate
      Type Parameters:
      T - the table type to delete from.
      Parameters:
      fromType - the table to delete from.
      Returns:
      the query builder.
    • query

      public Query query(String query)
      Description copied from interface: QueryTemplate
      Creates a query for the specified query string.
      Specified by:
      query in interface QueryTemplate
      Parameters:
      query - the query.
      Returns:
      the query.
    • query

      public Query query(StringTemplatePREVIEW template) throws PersistenceException
      Description copied from interface: QueryTemplate
      Creates a query for the specified query template.
      Specified by:
      query in interface QueryTemplate
      Parameters:
      template - the query template.
      Returns:
      the query.
      Throws:
      PersistenceException
    • subquery

      public <T extends Data> QueryBuilder<T,?,?> subquery(Class<T> fromType)
      Description copied from interface: SubqueryTemplate
      Create a subquery for the given table.
      Specified by:
      subquery in interface SubqueryTemplate
      Type Parameters:
      T - the table type to select from.
      Parameters:
      fromType - the table to create the subquery for.
      Returns:
      the subquery builder.
    • subquery

      public <T extends Data, R extends Data> QueryBuilder<T,?,?> subquery(Class<T> fromType, Class<R> selectType)
      Description copied from interface: SubqueryTemplate
      Create a subquery for the given table and select type.
      Specified by:
      subquery in interface SubqueryTemplate
      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

      public <T extends Data> QueryBuilder<T,?,?> subquery(Class<T> fromType, StringTemplatePREVIEW template)
      Description copied from interface: SubqueryTemplate
      Create a subquery for the given table and select type using the given template.
      Specified by:
      subquery in interface SubqueryTemplate
      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.