Examples of RollbackException


Examples of javax.persistence.RollbackException

    if ( tx == null || !tx.isActive() ) {
      throw new IllegalStateException( "Transaction not active" );
    }
    if ( rollbackOnly ) {
      tx.rollback();
      throw new RollbackException( "Transaction marked as rollbackOnly" );
    }
    try {
      tx.commit();
    }
    catch (Exception e) {
      Exception wrappedException;
      if (e instanceof StaleStateException) {
        wrappedException = entityManager.wrapStaleStateException( (StaleStateException) e );
      }
      else {
        wrappedException = e;
      }
      try {
        //as per the spec we should rollback if commit fails
        tx.rollback();
      }
      catch (Exception re) {
        //swallow
      }
      throw new RollbackException( "Error while commiting the transaction", wrappedException );
    }
    finally {
      rollbackOnly = false;
    }
    //if closed and we commit, the mode should have been adjusted already
View Full Code Here

Examples of javax.persistence.RollbackException

    if ( tx == null || !tx.isActive() ) {
      throw new IllegalStateException( "Transaction not active" );
    }
    if ( rollbackOnly ) {
      tx.rollback();
      throw new RollbackException( "Transaction marked as rollbackOnly" );
    }
    try {
      tx.commit();
    }
    catch (Exception e) {
      Exception wrappedException;
      if (e instanceof StaleStateException) {
        wrappedException = entityManager.wrapStaleStateException( (StaleStateException) e );
      }
      else if (e instanceof HibernateException) {
        throw entityManager.convert( (HibernateException)e );
      }
      else {
        wrappedException = e;
      }
      try {
        //as per the spec we should rollback if commit fails
        tx.rollback();
      }
      catch (Exception re) {
        //swallow
      }
      throw new RollbackException( "Error while commiting the transaction", wrappedException );
    }
    finally {
      rollbackOnly = false;
    }
    //if closed and we commit, the mode should have been adjusted already
View Full Code Here

Examples of javax.persistence.RollbackException

    if ( tx == null || !tx.isActive() ) {
      throw new IllegalStateException( "Transaction not active" );
    }
    if ( rollbackOnly ) {
      tx.rollback();
      throw new RollbackException( "Transaction marked as rollbackOnly" );
    }
    try {
      tx.commit();
    }
    catch (Exception e) {
      Exception wrappedException;
      if (e instanceof HibernateException) {
        wrappedException = entityManager.convert( (HibernateException)e );
      }
      else {
        wrappedException = e;
      }
      try {
        //as per the spec we should rollback if commit fails
        tx.rollback();
      }
      catch (Exception re) {
        //swallow
      }
      throw new RollbackException( "Error while committing the transaction", wrappedException );
    }
    finally {
      rollbackOnly = false;
    }
    //if closed and we commit, the mode should have been adjusted already
View Full Code Here

Examples of javax.persistence.RollbackException

    if ( tx == null || !tx.isActive() ) {
      throw new IllegalStateException( "Transaction not active" );
    }
    if ( rollbackOnly ) {
      tx.rollback();
      throw new RollbackException( "Transaction marked as rollbackOnly" );
    }
    try {
      tx.commit();
    }
    catch (Exception e) {
      Exception wrappedException;
      if (e instanceof HibernateException) {
        wrappedException = entityManager.convert( (HibernateException)e );
      }
      else {
        wrappedException = e;
      }
      try {
        //as per the spec we should rollback if commit fails
        tx.rollback();
      }
      catch (Exception re) {
        //swallow
      }
      throw new RollbackException( "Error while committing the transaction", wrappedException );
    }
    finally {
      rollbackOnly = false;
    }
    //if closed and we commit, the mode should have been adjusted already
View Full Code Here

Examples of javax.transaction.RollbackException

         if (status != Status.STATUS_ACTIVE && status != Status.STATUS_PREPARING && status != Status.STATUS_PREPARED && status != Status.STATUS_COMMITTING)
         {
            if (status == Status.STATUS_MARKED_ROLLBACK && IGNORE_STATUS_MARKED_FOR_ROLLBACK)
               // allow database access even though transaction is marked to fail
            else
               throw new RollbackException("Transaction " + tx + " cannot proceed " + TxUtils.getStatusAsString(status));
         }
      }
   }
View Full Code Here

Examples of javax.transaction.RollbackException

              }
              ,
              {
                 // thread 1
                 new MTOperation(MTOperation.XX_WAIT_FOR, 10)
                 new MTOperation(MTOperation.TX_COMMIT, 10, new RollbackException()),
                 new MTOperation(MTOperation.TM_GET_STATUS),
              }
           });        
      }
      else
View Full Code Here

Examples of javax.transaction.RollbackException

               // thread 1
               new MTOperation(MTOperation.TM_GET_STATUS),                 
               new MTOperation(MTOperation.XX_WAIT_FOR, 10),              
               new MTOperation(MTOperation.TM_RESUME, 10),
               new MTOperation(MTOperation.TM_GET_STATUS),              
               new MTOperation(MTOperation.TX_COMMIT, 10, new RollbackException()),
               new MTOperation(MTOperation.TM_GET_STATUS),              
            }
         });
      }
      else
View Full Code Here

Examples of javax.transaction.RollbackException

               new MTOperation(MTOperation.TM_GET_STATUS),
               new MTOperation(MTOperation.XX_SLEEP_200),
               new MTOperation(MTOperation.TM_GET_STATUS),

               // FIXME - JBTM-558
               new MTOperation(MTOperation.TM_COMMIT, -1, new RollbackException(), false)

            }
            ,
            {
               // thread 1
View Full Code Here

Examples of javax.transaction.RollbackException

            status = Status.STATUS_COMMITTED;

        } catch (XAException e) {

            if (e.errorCode >= XAException.XA_RBBASE && e.errorCode <= XAException.XA_RBEND) {
                throw new RollbackException(e.toString());
            }

            throw new SystemException("Unable to commit transaction: " + "XA_ERR=" + e.errorCode);
        }
    }
View Full Code Here

Examples of javax.transaction.RollbackException

      try
      {
         if (delegate.getRollbackOnly())
         {
            delegate.rollback();
            throw new RollbackException();
         }
         else
         {
            getSynchronizations().beforeTransactionCommit();
            delegate.commit();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.