Package javax.transaction

Examples of javax.transaction.UserTransaction.rollback()


    }
    catch (Exception e)
    {
      Log.error("TradeDirect:buy error - rolling back", e);
      if ( getInGlobalTxn() )
        txn.rollback();
      else
        rollBack(conn, e);
    }
    finally
    {
View Full Code Here


      if ( (accountData==null) || (holdingData==null) || (quoteData==null) )
      {
        String error = "TradeDirect:sell -- error selling stock -- unable to find:  \n\taccount=" +accountData + "\n\tholding=" + holdingData + "\n\tquote="+quoteData + "\nfor user: " + userID + " and holdingID: " + holdingID;
        Log.error(error);
        if ( getInGlobalTxn() )
          txn.rollback();
        else
          rollBack(conn, new Exception(error));             
        return orderData;
      }
View Full Code Here

    }
    catch (Exception e)
    {
      Log.error("TradeDirect:sell error", e);
      if ( getInGlobalTxn() )
        txn.rollback();
      else
        rollBack(conn, e);
    }
    finally
    {
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

      ut.begin();
      ts.enlistResource(xares);     
      xares.setFlag(5);
      assertEquals(5, xares.getFlag());
      ts.delistResource(xares);
      ut.rollback();
      assertEquals(0, xares.getFlag());
      assertEquals(0, xares.getOldFlag());

   }
View Full Code Here

            if( e instanceof BitronixRollbackException || e.getCause() instanceof TransientObjectException ) {
                rollBackExceptionthrown = true;
               
                // Depends on JTA version (and thus BTM version)
                if( tx.getStatus() == 1 ) {
                    tx.rollback();
                }
            }
        }          
        assertTrue( "A rollback exception should have been thrown because of foreign key violations.", rollBackExceptionthrown );
      
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

    {
      if(tx!=null)
      {
        try
        {
          tx.rollback();
        }
        catch (SystemException e1) {}
      }

      throw new RuntimeException("Unexpected invocation exception: " + e.getMessage(), 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.