@Requires(classes=org.springframework.orm.hibernate5.HibernateTransactionManager.class) @EachBean(value=org.springframework.orm.hibernate5.HibernateTransactionManager.class) @Internal @Replaces(value=SpringJdbcTransactionOperations.class) public class SpringHibernateTransactionOperations extends java.lang.Object implements TransactionOperations<java.sql.Connection>
Modifier | Constructor and Description |
---|---|
protected |
SpringHibernateTransactionOperations(org.springframework.orm.hibernate5.HibernateTransactionManager hibernateTransactionManager)
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 SpringHibernateTransactionOperations(org.springframework.orm.hibernate5.HibernateTransactionManager hibernateTransactionManager)
hibernateTransactionManager
- The hibernate transaction manager.public <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 back@NonNull public java.sql.Connection getConnection()
TransactionOperations
getConnection
in interface TransactionOperations<java.sql.Connection>
public <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