@EachBean(value=org.springframework.jdbc.datasource.DataSourceTransactionManager.class) @Internal @Requires(classes=org.springframework.jdbc.datasource.DataSourceTransactionManager.class) public class SpringJdbcTransactionOperations extends java.lang.Object implements TransactionOperations<java.sql.Connection>
TransactionOperations
that uses Spring managed transactions.Modifier | Constructor and Description |
---|---|
protected |
SpringJdbcTransactionOperations(org.springframework.jdbc.datasource.DataSourceTransactionManager transactionManager)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
<R> R |
execute(TransactionDefinition definition,
TransactionCallback<java.sql.Connection,R> callback)
Execute a read-only transaction within the context of the function.
|
<R> R |
executeRead(TransactionCallback<java.sql.Connection,R> callback)
Execute a read-only transaction within the context of the function.
|
<R> R |
executeWrite(TransactionCallback<java.sql.Connection,R> callback)
Execute a default transaction within the context of the function.
|
java.sql.Connection |
getConnection()
Obtains the connection for the current transaction.
|
protected SpringJdbcTransactionOperations(org.springframework.jdbc.datasource.DataSourceTransactionManager transactionManager)
transactionManager
- The transaction managerpublic <R> R executeRead(@NonNull TransactionCallback<java.sql.Connection,R> callback)
TransactionOperations
executeRead
in interface TransactionOperations<java.sql.Connection>
R
- The resultcallback
- The call backpublic <R> R executeWrite(@NonNull TransactionCallback<java.sql.Connection,R> callback)
TransactionOperations
executeWrite
in interface TransactionOperations<java.sql.Connection>
R
- The resultcallback
- The call backpublic <R> R execute(@NonNull TransactionDefinition definition, @NonNull TransactionCallback<java.sql.Connection,R> callback)
TransactionOperations
execute
in interface TransactionOperations<java.sql.Connection>
R
- The resultdefinition
- The transaction definitioncallback
- The call back@NonNull public java.sql.Connection getConnection()
TransactionOperations
getConnection
in interface TransactionOperations<java.sql.Connection>