Package javax.transaction

Examples of javax.transaction.TransactionManager.begin()


      // and cache loading or activation
      cache1.get(fqn, "k");
      if (tx)
         tm.commit();
      if (tx)
         tm.begin();
      // move event
      cache1.move(fqn, Fqn.ROOT);
      if (tx)
         tm.commit();
View Full Code Here


     
      //Set timeout to a large value since we do not want to time out while waiting for messages
      //to arrive - 10 years should be enough
      tm.setTransactionTimeout(60 * 60 * 24 * 365 * 10);
     
      tm.begin();
        
      Transaction tx = tm.getTransaction();
     
      //Remove the association between current thread - we don't want it
      //we will be committing /rolling back directly on the transaction object
View Full Code Here

      TransactionManager tm = (TransactionManager)ic.lookup("java:/TransactionManager");
      DataSource ds = (DataSource)ic.lookup("java:/DefaultDS");
      Connection c;


      tm.begin();

      c = ds.getConnection();
      c.createStatement().executeUpdate("CREATE TABLE SOME_TABLE (SOME_FIELD VARCHAR)");

      tm.commit();
View Full Code Here

      c = ds.getConnection();
      c.createStatement().executeUpdate("CREATE TABLE SOME_TABLE (SOME_FIELD VARCHAR)");

      tm.commit();

      tm.begin();
      c = ds.getConnection();
      c.createStatement().executeUpdate("INSERT INTO SOME_TABLE VALUES ('this shouldnt get into db')");

      tm.rollback();
View Full Code Here

      c = ds.getConnection();
      c.createStatement().executeUpdate("INSERT INTO SOME_TABLE VALUES ('this shouldnt get into db')");

      tm.rollback();

      tm.begin();
      c = ds.getConnection();
      c.createStatement().executeUpdate("INSERT INTO SOME_TABLE VALUES ('some value')");

      tm.commit();
View Full Code Here

      TransactionManager mgr = (TransactionManager)ctx.lookup(TransactionManagerService.JNDI_NAME);
      DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
     
      javax.transaction.Transaction txOld = mgr.suspend();
      mgr.begin();
     
      java.sql.Connection conn = null;
     
      PreparedStatement ps = null;
     
View Full Code Here

      TransactionManager mgr = (TransactionManager)ctx.lookup(TransactionManagerService.JNDI_NAME);
      DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
     
      javax.transaction.Transaction txOld = mgr.suspend();
      mgr.begin();
     
      java.sql.Connection conn = null;
     
      PreparedStatement ps = null;
     
View Full Code Here

         tm.setTransactionTimeout(timeout);

         try
         {
            // Start the transaction
            tm.begin();

            //notify checked out connections
            EJB2UserTransactionProvider.getSingleton().userTransactionStarted();
            if (tsl != null)
               tsl.userTransactionStarted();
View Full Code Here

  private void consumeInTransaction(Tuple tuple) {
    TransactionManager transactionManager = getTransactionManager();
    try {
      final Session session = factory.openSession();
      transactionManager.begin();
      delegate.run( session, tuple );
      transactionManager.commit();
      session.close();
    }
    catch ( Throwable e ) {
View Full Code Here

    final EntityManagerFactory emf = Persistence.createEntityManagerFactory( "jpajtastandalone", TestHelper.getEnvironmentProperties() );

    TransactionManager transactionManager = extractJBossTransactionManager( emf );

    transactionManager.begin();
    final EntityManager em = emf.createEntityManager();
    Poem poem = new Poem();
    poem.setName( "L'albatros" );
    em.persist( poem );
    transactionManager.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.