public class StandaloneMybatisTransactionContext extends Object implements TransactionContext
Modifier and Type | Field and Description |
---|---|
protected CommandContext |
commandContext |
protected Map<TransactionState,List<TransactionListener>> |
stateTransactionListeners |
Constructor and Description |
---|
StandaloneMybatisTransactionContext(CommandContext commandContext) |
Modifier and Type | Method and Description |
---|---|
void |
addTransactionListener(TransactionState transactionState,
TransactionListener transactionListener) |
void |
commit() |
protected void |
executeTransactionListeners(List<TransactionListener> transactionListeners,
CommandContext commandContext) |
protected void |
fireTransactionEvent(TransactionState transactionState,
boolean executeInNewContext)
Fires the event for the provided
TransactionState . |
protected DbSqlSession |
getDbSqlSession() |
void |
rollback() |
protected CommandContext commandContext
protected Map<TransactionState,List<TransactionListener>> stateTransactionListeners
public StandaloneMybatisTransactionContext(CommandContext commandContext)
public void addTransactionListener(TransactionState transactionState, TransactionListener transactionListener)
addTransactionListener
in interface TransactionContext
public void commit()
commit
in interface TransactionContext
protected void fireTransactionEvent(TransactionState transactionState, boolean executeInNewContext)
TransactionState
.transactionState
- The TransactionState
for which the listeners will be called.executeInNewContext
- If true, the listeners will be called in a new command context.
This is needed for example when firing the TransactionState.COMMITTED
event: the transaction is already committed and executing logic in the same
context could lead to strange behaviour (for example doing a SqlSession.update(String)
would actually roll back the update (as the MyBatis context is already committed
and the internal flags have not been correctly set).protected void executeTransactionListeners(List<TransactionListener> transactionListeners, CommandContext commandContext)
protected DbSqlSession getDbSqlSession()
public void rollback()
rollback
in interface TransactionContext
Copyright © 2016 Alfresco. All rights reserved.