FileDocCategorySizeDatePackage
EntityTransactionWrapper.javaAPI DocGlassfish v2 API5390Tue May 22 16:54:28 BST 2007oracle.toplink.essentials.internal.ejb.cmp3.transaction.base

EntityTransactionWrapper

public class EntityTransactionWrapper extends TransactionWrapperImpl
INTERNAL: Base EntityTransactionWrapper The EntityTransactionWrapper is used to make in transparent to an EntityManager what kind of transaction is being used. Transaction type can either be JTATransaction or EntityTransaciton and they are mutually exclusive. This is the implementation for EntityTransaction
see
oracle.toplink.essentials.internal.ejb.cmp3.transaction.EntityTransactionWrapper
see
oracle.toplink.essentials.internal.ejb.cmp3.transaction.jdk14.EntityTransactionWrapper

Fields Summary
protected EntityTransactionImpl
entityTransaction
Constructors Summary
public EntityTransactionWrapper(EntityManagerImpl entityManager)

        super(entityManager);
    
Methods Summary
public java.lang.ObjectcheckForTransaction(boolean validateExistence)
INTERNAL: This method will be used to check for a transaction and throws exception if none exists. If this methiod returns without exception then a transaction exists. This method must be called before accessing the localUOW.

        if (entityTransaction != null && entityTransaction.isActive()) {
            return entityTransaction;
        }
        if (validateExistence){
            throwCheckTransactionFailedException();
        }
        return null;
    
public oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImplgetEntityManager()

        return entityManager;
    
public oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWorkgetTransactionalUnitOfWork(java.lang.Object transaction)
INTERNAL: THis method is used to get the active UnitOfWork. It is special in that it will return the required RepeatableWriteUnitOfWork required by the EntityManager. Once RepeatableWrite is merged into existing UnitOfWork this code can go away.

        if (transaction == null){
            return null;
        }
        if (this.localUOW == null){
            this.localUOW = new RepeatableWriteUnitOfWork(entityManager.getServerSession().acquireClientSession());
            this.localUOW.setShouldCascadeCloneToJoinedRelationship(true);
        }
        return (RepeatableWriteUnitOfWork)this.localUOW;
    
public voidregisterUnitOfWorkWithTxn(oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl uow)

        throw new TransactionRequiredException(ExceptionLocalization.buildMessage("join_trans_called_on_entity_trans"));// no JTA transactions availab
    
public voidsetRollbackOnlyInternal()
Mark the current transaction so that the only possible outcome of the transaction is for the transaction to be rolled back. This is an internal method and if the txn is not active will do nothing

        if (entityTransaction != null && entityTransaction.isActive()){
            entityTransaction.setRollbackOnly();
        }
    
public booleanshouldFlushBeforeQuery(oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl uow)

        return true;
    
protected voidthrowCheckTransactionFailedException()

        throw TransactionException.transactionNotActive();