Examples of UserTransaction


Examples of javax.transaction.UserTransaction

     * @param canCommit true if the bean does not use the client transaction.
     * @throws Exception if an error during the tests occurs.
     */
    public void testUsingClientTransWithRuntimeException(final Class expectedException, final boolean canCommit)
            throws Exception {
        UserTransaction utx = ExceptionHandleUtil.getUserTransaction();
        utx.begin();
        // verifies if the exception thrown is correct
        try {
            sfsbContainerTransactionRuntime.insertCorrectFirstErrorSecond(DATABASE_1, DATABASE_2);
        } catch (Exception e) {
            assertTrue(ExceptionHelper.isEquals(e, expectedException),
                    "The container did not throw the correct exception, the expected exception is "
                            + expectedException.getName() + ", but the container threw " + e.getClass().getName());
        }
        // tries to commit
        try {
            utx.commit();
            if (!canCommit) {
                fail("The transaction was marked as rolled back, the client cannot make the commit.");
            }
        } catch (Exception e) {
            logger.debug("The bean threw an expected error during the execution {0}", e);
View Full Code Here

Examples of javax.transaction.UserTransaction

     * call a bean-managed transaction.
     * @throws Exception if an error occurs.
     */
    public void getUserTransactionWithLookup() throws Exception {
        try {
            UserTransaction utx = TransactionHelper.getUserTransaction();
            utx.begin();
            utx.commit();
        } catch (Exception e) {
            throw new TransactionException("The bean cannot get the user transaction with the JNDI", e);
        }
    }
View Full Code Here

Examples of javax.transaction.UserTransaction

     * container-managed transaction cannot call a bean-managed transaction.
     * @throws Exception if an error occurs.
     */
    public void getUserTransactionWithEJBContext() throws Exception {
        try {
            UserTransaction utx = ctx.getUserTransaction();
            utx.begin();
            utx.commit();
        } catch (Exception e) {
            throw new TransactionException("The bean cannot get the user transaction with the EJBContext", e);
        }
    }
View Full Code Here

Examples of javax.transaction.UserTransaction

     * @output the tables not created because the transaction rolled back.
     * @throws Exception if an error occurs during the tests.
     */
    @Test
    public void testSessionSyncWithMandatory() throws Exception {
        UserTransaction utx = getUserTransaction();
        utx.begin();
        sfsbSessionSync.insertTableMandatory();
        try{
            utx.commit();
        }catch(Exception e){
           logger.debug("The method threw an expected exception {e}", e);
        }
        verifyCallbacks();
    }
View Full Code Here

Examples of org.huihoo.workflow.store.persistent.UserTransaction

    if (joinType != null)
    {
      CaseDatabaseImpl caseDatabaseImpl = (CaseDatabaseImpl) workflowService.getCaseDatabase();
      SpiCaseDatabase caseDatabase = caseDatabaseImpl.getWrappedObject();

      UserTransaction userTransaction = null;
      MonitorEventResult eventResult = null;
      try
      {
        userTransaction = caseDatabase.getUserTransaction();

        if (JoinType.JOIN_AND.equals(joinType))
        {
          eventResult =
            dispatch_andJoin(
              workflowService,
              workflowProcess,
              operator,
              event_userTransaction,
              caseDatabase,
              userTransaction,
              workflowWork,
              workflowTransition);
        }

        if (JoinType.JOIN_XOR.equals(joinType))
        {
          eventResult =
            dispatch_xorJoin(
              workflowService,
              workflowProcess,
              operator,
              event_userTransaction,
              caseDatabase,
              userTransaction,
              workflowWork,
              workflowTransition);
        }

        if (JoinType.JOIN_OR.equals(joinType))
        {
          eventResult =
            dispatch_orJoin(
              workflowService,
              workflowProcess,
              operator,
              event_userTransaction,
              caseDatabase,
              userTransaction,
              workflowWork,
              workflowTransition);
        }

        if (JoinType.JOIN_WEIGHT.equals(joinType))
        {
          eventResult =
            dispatch_weightJoin(
              workflowService,
              workflowProcess,
              operator,
              event_userTransaction,
              caseDatabase,
              userTransaction,
              workflowWork,
              workflowTransition);
        }

        userTransaction.commit();
      }
      catch (WorkflowException ex)
      {
        if (userTransaction != null)
        {
          try
          {
            userTransaction.rollback();
          }
          catch (TransactionException e)
          {
            ;
          }
        }

        eventResult = new MonitorEventResult();
        eventResult.setException(ex);
      }
      finally
      {
        if (userTransaction != null)
        {
          try
          {
            userTransaction.release();
          }
          catch (TransactionException e)
          {
            ;
          }
View Full Code Here

Examples of org.jboss.seam.transaction.UserTransaction

      return entityManager;
   }

   private void joinTransaction() throws SystemException
   {
      UserTransaction transaction = Transaction.instance();
      if ( transaction.isActive() )
      {
         transaction.enlist(entityManager);
         try
         {
            transaction.registerSynchronization(this);
            synchronizationRegistered = true;
         }
         catch (Exception e)
         {
            synchronizationRegistered = PersistenceProvider.instance().registerSynchronization(this, entityManager);
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.