@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 |
executeRead(TransactionCallback<java.sql.Connection,R> callback)
Execute a read operation for the given
TransactionCallback . |
<R> R |
executeWrite(TransactionCallback<java.sql.Connection,R> callback)
Execute a write operation for the given
TransactionCallback . |
java.sql.Connection |
getConnection()
Obtains the connection for the current transaction.
|
protected SpringJdbcTransactionOperations(org.springframework.jdbc.datasource.DataSourceTransactionManager transactionManager)
transactionManager
- The transaction manager@Nullable public <R> R executeWrite(@NonNull TransactionCallback<java.sql.Connection,R> callback)
TransactionOperations
TransactionCallback
.executeWrite
in interface TransactionOperations<java.sql.Connection>
R
- The return typecallback
- The callback@Nullable public <R> R executeRead(@NonNull TransactionCallback<java.sql.Connection,R> callback)
TransactionOperations
TransactionCallback
.executeRead
in interface TransactionOperations<java.sql.Connection>
R
- The return typecallback
- The callback@NonNull public java.sql.Connection getConnection()
TransactionOperations
getConnection
in interface TransactionOperations<java.sql.Connection>