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> R
execute
(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.Session
Obtains the connection for the current transaction.boolean
Check if the connection exists.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.transaction.TransactionOperations
executeRead, executeWrite
-
Method Details
-
findTransactionStatus
Description copied from interface:TransactionOperations
Find optional propagated transaction status.- Specified by:
findTransactionStatus
in interfaceTransactionOperations<org.hibernate.Session>
- Returns:
- The transaction status.
-
getConnection
public org.hibernate.Session getConnection()Description copied from interface:TransactionOperations
Obtains the connection for the current transaction.- Specified by:
getConnection
in interfaceTransactionOperations<org.hibernate.Session>
- Returns:
- The connection
-
hasConnection
public boolean hasConnection()Description copied from interface:TransactionOperations
Check if the connection exists.- Specified by:
hasConnection
in 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:TransactionOperations
Execute a transaction within the context of the function.- Specified by:
execute
in interfaceTransactionOperations<org.hibernate.Session>
- Type Parameters:
R
- The result- Parameters:
definition
- The transaction definitioncallback
- The call back- Returns:
- The result
-