- Enclosing interface:
ORMTemplate
ORMTemplate with instance-scoped integration strategies.- Since:
- 1.13
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the ORM template.config(StormConfig config) Sets the Storm configuration to apply to the template instance.connectionProvider(st.orm.core.spi.ConnectionProvider connectionProvider) Sets the connection provider used by the template to acquire and release connections.decorator(UnaryOperator<TemplateDecorator> decorator) Sets a function that transforms theTemplateDecoratorto customize template processing.exceptionMapper(st.orm.core.spi.ExceptionMapper exceptionMapper) Sets the exception mapper that maps failures raised during query execution to the runtime exception thrown to the caller.Declares that the data source hands out connections with auto-commit disabled.queryObserver(st.orm.core.spi.QueryObserver queryObserver) Sets the query observer that is notified of query executions performed by the template.sqlCommenter(st.orm.core.spi.SqlCommenter sqlCommenter) Sets the SQL commenter that appends per-execution comment content to statements, such as the current trace context.transactionTemplateProvider(st.orm.core.spi.TransactionTemplateProvider transactionTemplateProvider) Sets the transaction template provider used by the template to participate in transactions.
-
Method Details
-
config
Sets the Storm configuration to apply to the template instance.- Parameters:
config- the Storm configuration; must not benull.- Returns:
- this builder.
-
decorator
Sets a function that transforms theTemplateDecoratorto customize template processing.- Parameters:
decorator- the decorator function; must not benull.- Returns:
- this builder.
-
connectionProvider
public ORMTemplate.Builder connectionProvider(st.orm.core.spi.ConnectionProvider connectionProvider) Sets the connection provider used by the template to acquire and release connections.Only valid for data source backed templates;
build()fails fast otherwise.- Parameters:
connectionProvider- the connection provider; must not benull.- Returns:
- this builder.
-
manualCommitConnections
Declares that the data source hands out connections with auto-commit disabled.The declared mode is verified in both directions: a declared template that receives an auto-commit connection fails fast naming the misdeclaration, exactly like an undeclared template that receives a manual-commit one. With the declaration in place, the transactional path performs no auto-commit flips and releases connections in their arrived state; non-transactional connections get auto-commit enabled while Storm uses them and restored before release, so each statement still commits.
Cannot be combined with a custom
connection providerand only valid for data source backed templates;build()fails fast otherwise.- Returns:
- this builder.
- Since:
- 1.14
-
transactionTemplateProvider
public ORMTemplate.Builder transactionTemplateProvider(st.orm.core.spi.TransactionTemplateProvider transactionTemplateProvider) Sets the transaction template provider used by the template to participate in transactions.Templates that should share transactions must be configured with the same provider instance.
- Parameters:
transactionTemplateProvider- the transaction template provider; must not benull.- Returns:
- this builder.
-
exceptionMapper
Sets the exception mapper that maps failures raised during query execution to the runtime exception thrown to the caller.- Parameters:
exceptionMapper- the exception mapper; must not benull.- Returns:
- this builder.
-
queryObserver
Sets the query observer that is notified of query executions performed by the template.- Parameters:
queryObserver- the query observer; must not benull.- Returns:
- this builder.
-
sqlCommenter
Sets the SQL commenter that appends per-execution comment content to statements, such as the current trace context. Note that per-execution content defeats prepared statement caching.- Parameters:
sqlCommenter- the SQL commenter; must not benull.- Returns:
- this builder.
- Since:
- 1.13
-
build
Builds the ORM template.- Returns:
- the ORM template.
-