Module storm

Interface PreparedStatementTemplate

All Known Implementing Classes:
PreparedStatementTemplateImpl

public interface PreparedStatementTemplate
PreparedStatementTemplate relies on preview features of the Java platform:
  • PreparedStatementTemplate refers to one or more preview APIs: StringTemplate.
Programs can only use PreparedStatementTemplate when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
A template backed by JDBC.
  • Method Details

    • of

      static PreparedStatementTemplate of(@Nonnull DataSource dataSource)
      Creates a new prepared statement template for the given data source.
      Parameters:
      dataSource - the data source.
      Returns:
      the prepared statement template.
    • of

      static PreparedStatementTemplate of(@Nonnull Connection connection)
      Creates a new prepared statement template for the given connection.

      Note: The caller is responsible for closing the connection after usage.

      Parameters:
      connection - the connection.
      Returns:
      the prepared statement template.
    • ORM

      static ORMTemplate ORM(@Nonnull DataSource dataSource)
      Creates a new ORM template for the given data source.
      Parameters:
      dataSource - the data source.
      Returns:
      the ORM template.
    • ORM

      static ORMTemplate ORM(@Nonnull Connection connection)
      Creates a new ORM template for the given connection.

      Note: The caller is responsible for closing the connection after usage.

      Parameters:
      connection - the connection.
      Returns:
      the ORM template.
    • withTableNameResolver

      PreparedStatementTemplate withTableNameResolver(@Nonnull TableNameResolver tableNameResolver)
      Returns a new prepared statement template with the specified table name resolver.
      Parameters:
      tableNameResolver - the table name resolver.
      Returns:
      a new prepared statement template.
    • withColumnNameResolver

      PreparedStatementTemplate withColumnNameResolver(@Nonnull ColumnNameResolver columnNameResolver)
      Returns a new prepared statement template with the specified column name resolver.
      Parameters:
      columnNameResolver - the column name resolver.
      Returns:
      a new prepared statement template.
    • withForeignKeyResolver

      PreparedStatementTemplate withForeignKeyResolver(@Nonnull ForeignKeyResolver foreignKeyResolver)
      Returns a new prepared statement template with the specified foreign key resolver.
      Parameters:
      foreignKeyResolver - the foreign key resolver.
      Returns:
      a new prepared statement template.
    • withTableAliasResolver

      PreparedStatementTemplate withTableAliasResolver(@Nonnull TableAliasResolver tableAliasResolver)
      Returns a new prepared statement template with the specified table alias resolver.
      Parameters:
      tableAliasResolver - the table alias resolver.
      Returns:
      a new prepared statement template.
    • withProviderFilter

      PreparedStatementTemplate withProviderFilter(@Nonnull Predicate<Provider> providerFilter)
      Returns a new prepared statement template with the specified provider filter.
      Parameters:
      providerFilter - the provider filter.
      Returns:
      a new prepared statement template.
    • toORM

      ORMTemplate toORM()
      Returns an ORM template that is backed by this prepared statement template.
      Returns:
      the ORM template.
    • createBindVars

      BindVars createBindVars()
      Create a new bind variables instance that can be used to add bind variables to a batch.
      Returns:
      a new bind variables instance.
    • query

      PreparedStatement query(@Nonnull StringTemplatePREVIEW template) throws SQLException
      Creates a query for the specified query template.
      Parameters:
      template - the query template.
      Returns:
      the query.
      Throws:
      SQLException