- All Known Implementing Classes:
PreparedStatementTemplateImpl
public interface PreparedStatementTemplate
PreparedStatementTemplate relies on preview features of the Java platform:
PreparedStatementTemplaterefers to one or more preview APIs:StringTemplate.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
A template backed by JDBC.
-
Method Summary
Modifier and TypeMethodDescriptionCreate a new bind variables instance that can be used to add bind variables to a batch.static PreparedStatementTemplateof(Connection connection) Creates a new prepared statement template for the given connection.static PreparedStatementTemplateof(DataSource dataSource) Creates a new prepared statement template for the given data source.static ORMTemplateORM(Connection connection) Creates a new ORM template for the given connection.static ORMTemplateORM(DataSource dataSource) Creates a new ORM template for the given data source.query(StringTemplatePREVIEW template) Creates a query for the specified querytemplate.toORM()Returns an ORM template that is backed by this prepared statement template.withColumnNameResolver(ColumnNameResolver columnNameResolver) Returns a new prepared statement template with the specified column name resolver.withForeignKeyResolver(ForeignKeyResolver foreignKeyResolver) Returns a new prepared statement template with the specified foreign key resolver.withProviderFilter(Predicate<Provider> providerFilter) Returns a new prepared statement template with the specified provider filter.withTableAliasResolver(TableAliasResolver tableAliasResolver) Returns a new prepared statement template with the specified table alias resolver.withTableNameResolver(TableNameResolver tableNameResolver) Returns a new prepared statement template with the specified table name resolver.
-
Method Details
-
of
Creates a new prepared statement template for the given data source.- Parameters:
dataSource- the data source.- Returns:
- the prepared statement template.
-
of
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
Creates a new ORM template for the given data source.- Parameters:
dataSource- the data source.- Returns:
- the ORM template.
-
ORM
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
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
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
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
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
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
Creates a query for the specified querytemplate.- Parameters:
template- the query template.- Returns:
- the query.
- Throws:
SQLException
-
PreparedStatementTemplatewhen preview features are enabled.