Package org.mybatis.cdi
Class LocalTransactionInterceptor
- java.lang.Object
-
- org.mybatis.cdi.LocalTransactionInterceptor
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
JtaTransactionInterceptor
@Interceptor public class LocalTransactionInterceptor extends Object implements Serializable
Best-effort interceptor for local transactions. It locates all the instances ofSqlSssionManager
and starts transactions on all them. It cannot guarantee atomiticy if there is more than oneSqlSssionManager
. Use XA drivers, a JTA container and theJtaTransactionInterceptor
in that case.- Author:
- Frank David MartÃnez
- See Also:
JtaTransactionInterceptor
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LocalTransactionInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
beginJta()
Begin jta.protected void
endJta(boolean isExternaTransaction, boolean commit)
End jta.protected Transactional
getTransactionalAnnotation(javax.interceptor.InvocationContext ctx)
Object
invoke(javax.interceptor.InvocationContext ctx)
Invoke.protected boolean
isTransactionActive()
Checks if is transaction active.
-
-
-
Method Detail
-
invoke
public Object invoke(javax.interceptor.InvocationContext ctx) throws Exception
Invoke.- Parameters:
ctx
- the ctx- Returns:
- the object
- Throws:
Exception
- the exception
-
isTransactionActive
protected boolean isTransactionActive() throws SystemException
Checks if is transaction active.- Returns:
- true, if is transaction active
- Throws:
SystemException
- used by jtaTransactionInterceptor
-
beginJta
protected void beginJta() throws NotSupportedException, SystemException
Begin jta.- Throws:
NotSupportedException
- used by jtaTransactionInterceptorSystemException
- used by jtaTransactionInterceptor
-
endJta
protected void endJta(boolean isExternaTransaction, boolean commit) throws SystemException, RollbackException, HeuristicMixedException, HeuristicRollbackException
End jta.- Parameters:
isExternaTransaction
- the is externa transactioncommit
- the commit- Throws:
SystemException
- used by jtaTransactionInterceptorRollbackException
- used by jtaTransactionInterceptorHeuristicMixedException
- used by jtaTransactionInterceptorHeuristicRollbackException
- used by jtaTransactionInterceptor
-
getTransactionalAnnotation
protected Transactional getTransactionalAnnotation(javax.interceptor.InvocationContext ctx)
-
-