Package org.mybatis.cdi
Class LocalTransactionInterceptor
java.lang.Object
org.mybatis.cdi.LocalTransactionInterceptor
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
JtaTransactionInterceptor
Best-effort interceptor for local transactions. It locates all the instances of
SqlSssionManager and starts
transactions on all them. It cannot guarantee atomiticy if there is more than one SqlSssionManager. Use XA
drivers, a JTA container and the JtaTransactionInterceptor in that case.- Author:
- Frank David MartÃnez
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbeginJta()Begin jta.protected voidendJta(boolean isExternaTransaction, boolean commit) End jta.protected TransactionalgetTransactionalAnnotation(jakarta.interceptor.InvocationContext ctx) invoke(jakarta.interceptor.InvocationContext ctx) Invoke.protected booleanChecks if is transaction active.
-
Constructor Details
-
LocalTransactionInterceptor
public LocalTransactionInterceptor()
-
-
Method Details
-
invoke
Invoke.- Parameters:
ctx- the ctx- Returns:
- the object
- Throws:
Exception- the exception
-
isTransactionActive
protected boolean isTransactionActive() throws jakarta.transaction.SystemExceptionChecks if is transaction active.- Returns:
- true, if is transaction active
- Throws:
jakarta.transaction.SystemException- used by jtaTransactionInterceptor
-
beginJta
protected void beginJta() throws jakarta.transaction.NotSupportedException, jakarta.transaction.SystemExceptionBegin jta.- Throws:
jakarta.transaction.NotSupportedException- used by jtaTransactionInterceptorjakarta.transaction.SystemException- used by jtaTransactionInterceptor
-
endJta
protected void endJta(boolean isExternaTransaction, boolean commit) throws jakarta.transaction.SystemException, jakarta.transaction.RollbackException, jakarta.transaction.HeuristicMixedException, jakarta.transaction.HeuristicRollbackException End jta.- Parameters:
isExternaTransaction- the is externa transactioncommit- the commit- Throws:
jakarta.transaction.SystemException- used by jtaTransactionInterceptorjakarta.transaction.RollbackException- used by jtaTransactionInterceptorjakarta.transaction.HeuristicMixedException- used by jtaTransactionInterceptorjakarta.transaction.HeuristicRollbackException- used by jtaTransactionInterceptor
-
getTransactionalAnnotation
-