Package javax.transaction

Examples of javax.transaction.UserTransaction.commit()


        }catch(IllegalException e){
           logger.debug("The container threw an expected exception {0}", e);
        }finally{
            // the container must not mark the transaction for rollback, so the
            // commit should work.
            utx.commit();
        }
        //verifies if the commit worked
        verifyTable(DB_NAME);
    }
View Full Code Here


        // the method is working with transaction...
        UserTransaction utx = TransactionHelper.getInternalUserTransaction();
        utx.begin();
        bean.insertTable01(DB_NAME, TABLE_NAME);
        utx.commit();

        // cleans the db to avoid error
        deleteTable(DB_NAME, TABLE_NAME);

        // the method is working without transaction
View Full Code Here

        // method must work with or without a client transaction.

        // the method is working with transaction...
        utx.begin();
        bean.insertTable03(DB_NAME, TABLE_NAME, 1);
        utx.commit();

        // cleans the db to avoid error
        deleteTable(DB_NAME, TABLE_NAME);

        // the method is working without transaction
View Full Code Here

            System.out.println("First request on the new bean");
            statefulBean.buy(FIRST_BUY_AMOUNT);
            System.out.println("Second request on the bean");
            statefulBean.buy(SECOND_BUY_AMOUNT);
            System.out.println("Commit the transaction");
            utx.commit();
        } catch (Exception e) {
            System.err.println("exception during 1st Tx: " + e);
            System.exit(2);
        }
View Full Code Here

     */
    public void verifyBMT() throws IllegalStateException, SecurityException, HeuristicMixedException,
            HeuristicRollbackException, RollbackException, SystemException, NotSupportedException, NamingException {
        UserTransaction utx = TransactionHelper.getUserTransaction();
        utx.begin();
        utx.commit();
    }
}
View Full Code Here

        // creates the table
        if (!bolOnlyCreateTrans) {
            tableManager.insertTable(TABLE);
        }
        // does the commit in the nested transaction
        utxNested.commit();
        // does the commit in the bean transaction
        utx.commit();

    }
View Full Code Here

            if (!bolOnlyCreateTrans) {
                tableManager.insertTable(TABLE);
            }
            // does the commit in the nested transaction
            // does the commit in the nested transaction
            utxNested.commit();
        } catch (Exception e) {
            utxNested.rollback();
            if (this.getTransactionStatus() != Status.STATUS_NO_TRANSACTION) {
                utx.rollback();
            }
View Full Code Here

      }
      finally {
         if (clientTx)
            try
         {
               tx.commit();
         }
         catch (Throwable e)
         {
            System.out.println("User tx commit failure: " + e.getMessage());
         }
View Full Code Here

      getLog().debug("Try to instantiate a UserTransaction");
      UserTransaction userTx = (UserTransaction)ctx.lookup("UserTransaction");
      userTx.begin();
         bean.incCounter();
         bean.incCounter();
      userTx.commit();
      int counter = bean.getCounter();
      assertTrue("counter == 102", counter == 102);

      bean.setCounter(100);
      userTx.begin();
View Full Code Here

      ut.begin();
      CtsCmpHome home = (CtsCmpHome) ctx.lookup("ejbcts/CMPBean");
      AccountPK pk = new AccountPK("testWithInvalidDefaultJndiContext");
      CtsCmp bean = home.create(pk, "Scott");
      bean.setPersonsAge(40);
      ut.commit();

      assertTrue("age == 40", bean.getPersonsAge() == 40);

      ut.begin();
      bean.setPersonsAge(100);
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.