Package javax.transaction

Examples of javax.transaction.UserTransaction.rollback()


     }
     catch (Throwable t)
     {
       if(tx!=null)
         try {
           tx.rollback();
         } catch (SystemException e) {
           //
         }
       throw new RuntimeException("Failed to create database", t);
     }
View Full Code Here


               tx.begin();
               if (checkAndSetState())
               {
                  try
                  {
                     tx.rollback();
                  }
                  catch (Exception e)
                  {
                  }
                  return;
View Full Code Here

                  cache.put(fqn, m, i);
                  if (checkAndSetState())
                  {
                     try
                     {
                        tx.rollback();
                     }
                     catch (Exception e)
                     {
                     }
                     return;
View Full Code Here

//
        // insert and rollback
        ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );
        ut.begin();
        ksession.insert( 3 );
        ut.rollback();

        // check we rolled back the state changes from the 3rd insert
        ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );
        ut.begin();       
        ksession.fireAllRules();
View Full Code Here

        // rollback again, this is testing that we can do consecutive rollbacks and commits without issue
        ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );
        ut.begin();
        ksession.insert( 5 );
        ksession.insert( 6 );
        ut.rollback();

        ksession.fireAllRules();

        assertEquals( 4,
                      list.size() );
View Full Code Here

        // starts the transaction
        utx.begin();
        // call the method that must have the same transaction context
        sfsbContainerTransaction.insertCorrectTableInBothDB(DATABASE_1, DATABASE_2);
        // rollback the transaction
        utx.rollback();
    }

    /**
     * @see org.ow2.easybeans.tests.common.interfaces.ItfTestContainerManaged#testSetRollbackOnly()
     * @throws Exception if an error during the tests occurs.
View Full Code Here

     */
    public void cleanTransaction() throws Exception {
        UserTransaction utx = TransactionHelper.getInternalUserTransaction();
        try {
            if (transactionIsActive()) {
                utx.rollback();
           }
        } catch (Exception e) {
            throw new Exception("Cannot clean the transaction. The test cannot be started", e);
        }
    }
View Full Code Here

        UserTransaction utx = getUserTransaction();
        utx.begin();
        try {
            super.testGetUserTransactionWithEJBContext();
        } finally {
            utx.rollback();
        }
    }

    /**
     * @see org.ow2.easybeans.tests.common.interfaces.ItfTestContainerManaged#testGetUserTransactionWithLookup()
View Full Code Here

        UserTransaction utx = getUserTransaction();
        utx.begin();
        try {
            super.testGetUserTransactionWithLookup();
        } finally {
            utx.rollback();
        }
    }

}
View Full Code Here

                TableManager tableManager = new TableManager(dbName);
                tableManager.deleteTable(TABLE);
            }
            utx.commit();
        } catch (Exception e) {
            utx.rollback();
            throw new TransactionException("Error during commit.", e);
        }

    }
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.