org.hibernate.engine.transaction.internal.jta
Class CMTTransaction

java.lang.Object
  extended by org.hibernate.engine.transaction.spi.AbstractTransactionImpl
      extended by org.hibernate.engine.transaction.internal.jta.CMTTransaction
All Implemented Interfaces:
TransactionImplementor, Transaction

public class CMTTransaction
extends AbstractTransactionImpl

Implements a transaction strategy for Container Managed Transaction (CMT) scenarios. All work is done in the context of the container managed transaction.

The term 'CMT' is potentially misleading; the pertinent point simply being that the transactions are being managed by something other than the Hibernate transaction mechanism.

Additionally, this strategy does *not* attempt to access or use the UserTransaction since in the actual case CMT access to the UserTransaction is explicitly disallowed. Instead we use the JTA Transaction object obtained from the TransactionManager


Constructor Summary
protected CMTTransaction(TransactionCoordinator transactionCoordinator)
           
 
Method Summary
protected  void afterAfterCompletion()
           
protected  void afterTransactionBegin()
           
protected  void afterTransactionCompletion(int status)
           
protected  void beforeTransactionCommit()
           
protected  void beforeTransactionRollBack()
           
 IsolationDelegate createIsolationDelegate()
          Retrieve an isolation delegate appropriate for this transaction strategy.
protected  void doBegin()
          Perform the actual steps of beginning a transaction according to the strategy.
protected  void doCommit()
          Perform the actual steps of committing a transaction according to the strategy.
protected  void doRollback()
          Perform the actual steps of rolling back a transaction according to the strategy.
 JoinStatus getJoinStatus()
          Get the current state of this transaction's join status.
 boolean isActive()
          Is this transaction still active?

Answers on a best effort basis.

 boolean isInitiator()
          Is this transaction the initiator of any underlying transaction?
 void join()
          Perform a join to the underlying transaction
 void markForJoin()
          Mark a transaction as joinable
 void markRollbackOnly()
          Make a best effort to mark the underlying transaction for rollback only.
 void resetJoinStatus()
          Reset this transaction's join status.
protected  TransactionManager transactionManager()
           
 
Methods inherited from class org.hibernate.engine.transaction.spi.AbstractTransactionImpl
allowFailedCommitToPhysicallyRollback, begin, commit, doExtendedActiveCheck, getLocalStatus, getTimeout, invalidate, isParticipating, jtaPlatform, registerSynchronization, rollback, setTimeout, transactionCoordinator, wasCommitted, wasRolledBack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CMTTransaction

protected CMTTransaction(TransactionCoordinator transactionCoordinator)
Method Detail

transactionManager

protected TransactionManager transactionManager()

doBegin

protected void doBegin()
Description copied from class: AbstractTransactionImpl
Perform the actual steps of beginning a transaction according to the strategy.

Specified by:
doBegin in class AbstractTransactionImpl

afterTransactionBegin

protected void afterTransactionBegin()
Specified by:
afterTransactionBegin in class AbstractTransactionImpl

beforeTransactionCommit

protected void beforeTransactionCommit()
Specified by:
beforeTransactionCommit in class AbstractTransactionImpl

doCommit

protected void doCommit()
Description copied from class: AbstractTransactionImpl
Perform the actual steps of committing a transaction according to the strategy.

Specified by:
doCommit in class AbstractTransactionImpl

beforeTransactionRollBack

protected void beforeTransactionRollBack()
Specified by:
beforeTransactionRollBack in class AbstractTransactionImpl

doRollback

protected void doRollback()
Description copied from class: AbstractTransactionImpl
Perform the actual steps of rolling back a transaction according to the strategy.

Specified by:
doRollback in class AbstractTransactionImpl

afterTransactionCompletion

protected void afterTransactionCompletion(int status)
Specified by:
afterTransactionCompletion in class AbstractTransactionImpl

afterAfterCompletion

protected void afterAfterCompletion()
Specified by:
afterAfterCompletion in class AbstractTransactionImpl

isActive

public boolean isActive()
                 throws TransactionException
Description copied from interface: Transaction
Is this transaction still active?

Answers on a best effort basis. For example, in the case of JDBC based transactions we cannot know that a transaction is active when it is initiated directly through the JDBC Connection, only when it is initiated from here.

Specified by:
isActive in interface Transaction
Overrides:
isActive in class AbstractTransactionImpl
Returns:
true if the transaction is still active; false otherwise.
Throws:
TransactionException

createIsolationDelegate

public IsolationDelegate createIsolationDelegate()
Description copied from interface: TransactionImplementor
Retrieve an isolation delegate appropriate for this transaction strategy.

Returns:
An isolation delegate.

isInitiator

public boolean isInitiator()
Description copied from interface: Transaction
Is this transaction the initiator of any underlying transaction?

Returns:
true if this transaction initiated the underlying transaction; false otherwise.

markRollbackOnly

public void markRollbackOnly()
Description copied from interface: TransactionImplementor
Make a best effort to mark the underlying transaction for rollback only.


markForJoin

public void markForJoin()
Description copied from interface: TransactionImplementor
Mark a transaction as joinable

Specified by:
markForJoin in interface TransactionImplementor
Overrides:
markForJoin in class AbstractTransactionImpl

join

public void join()
Description copied from interface: TransactionImplementor
Perform a join to the underlying transaction

Specified by:
join in interface TransactionImplementor
Overrides:
join in class AbstractTransactionImpl

resetJoinStatus

public void resetJoinStatus()
Description copied from interface: TransactionImplementor
Reset this transaction's join status.

Specified by:
resetJoinStatus in interface TransactionImplementor
Overrides:
resetJoinStatus in class AbstractTransactionImpl

getJoinStatus

public JoinStatus getJoinStatus()
Description copied from interface: TransactionImplementor
Get the current state of this transaction's join status.

Returns:
The current join status


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.