Class SpringHibernateTransactionOperations
java.lang.Object
io.micronaut.data.spring.jpa.hibernate.SpringHibernateTransactionOperations
- All Implemented Interfaces:
TransactionOperations<org.hibernate.Session>
@Requires(classes=org.springframework.orm.hibernate5.HibernateTransactionManager.class,
condition=io.micronaut.data.spring.jpa.hibernate.SpringHibernateTransactionManagerCondition.class)
@EachBean(org.springframework.orm.hibernate5.HibernateTransactionManager.class)
@Replaces(HibernateTransactionManager.class)
@Internal
public final class SpringHibernateTransactionOperations
extends Object
implements TransactionOperations<org.hibernate.Session>
Adds Spring Transaction management capability to Micronaut Data.
- Since:
- 1.0.0
- Author:
- graemerocher
-
Method Summary
Modifier and TypeMethodDescription<R> Rexecute(TransactionDefinition definition, TransactionCallback<org.hibernate.Session, R> callback) Execute a transaction within the context of the function.Optional<? extends TransactionStatus<?>>Find optional propagated transaction status.org.hibernate.SessionObtains the connection for the current transaction.booleanCheck if the connection exists.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.transaction.TransactionOperations
executeRead, executeWrite
-
Method Details
-
findTransactionStatus
Description copied from interface:TransactionOperationsFind optional propagated transaction status.- Specified by:
findTransactionStatusin interfaceTransactionOperations<org.hibernate.Session>- Returns:
- The transaction status.
-
getConnection
public org.hibernate.Session getConnection()Description copied from interface:TransactionOperationsObtains the connection for the current transaction.- Specified by:
getConnectionin interfaceTransactionOperations<org.hibernate.Session>- Returns:
- The connection
-
hasConnection
public boolean hasConnection()Description copied from interface:TransactionOperationsCheck if the connection exists.- Specified by:
hasConnectionin interfaceTransactionOperations<org.hibernate.Session>- Returns:
- True if transaction exists
-
execute
public <R> R execute(TransactionDefinition definition, TransactionCallback<org.hibernate.Session, R> callback) Description copied from interface:TransactionOperationsExecute a transaction within the context of the function.- Specified by:
executein interfaceTransactionOperations<org.hibernate.Session>- Type Parameters:
R- The result- Parameters:
definition- The transaction definitioncallback- The call back- Returns:
- The result
-