Package org.springframework.transaction.support

Examples of org.springframework.transaction.support.TransactionCallbackWithoutResult


    }

    public void process(final Exchange exchange) {
        LOG.info("transaction begin");

        transactionTemplate.execute(new TransactionCallbackWithoutResult() {
            protected void doInTransactionWithoutResult(TransactionStatus status) {
                try {
                    processNext(exchange);
                } catch (Exception e) {
                    throw new RuntimeCamelException(e);
View Full Code Here


      JtaTransactionManager ptm = new JtaTransactionManager(ut);
      final TransactionTemplate tt = new TransactionTemplate(ptm);
      assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());
      assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));

      tt.execute(new TransactionCallbackWithoutResult() {
        public void doInTransactionWithoutResult(TransactionStatus status) {
          tt.execute(new TransactionCallbackWithoutResult() {
            public void doInTransactionWithoutResult(TransactionStatus status) {
              status.setRollbackOnly();
              try {
                assertTrue("JTA synchronizations active", TransactionSynchronizationManager.isSynchronizationActive());
                assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
View Full Code Here

    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());

    TransactionTemplate tt = new TransactionTemplate(new JtaTransactionManager(tm));
    tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_SUPPORTS);
    tt.setReadOnly(true);
    tt.execute(new TransactionCallbackWithoutResult() {
      protected void doInTransactionWithoutResult(TransactionStatus status) {
        assertTrue("JTA synchronizations active", TransactionSynchronizationManager.isSynchronizationActive());
        for (int i = 0; i < 5; i++) {
          ht.executeFind(new HibernateCallback() {
            public Object doInHibernate(org.hibernate.Session sess) {
View Full Code Here

        }
      });
    }

    TransactionTemplate tt = new TransactionTemplate(new JtaTransactionManager(ut));
    tt.execute(new TransactionCallbackWithoutResult() {
      protected void doInTransactionWithoutResult(TransactionStatus status) {
        for (int i = 2; i < 5; i++) {
          ht.executeFind(new HibernateCallback() {
            public Object doInHibernate(org.hibernate.Session sess) {
              assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
View Full Code Here

  }

  public void testSavepoint() {
    TransactionTemplate tt = new TransactionTemplate(transactionManager);
    tt.setPropagationBehavior(TransactionTemplate.PROPAGATION_NESTED);
    tt.execute(new TransactionCallbackWithoutResult() {
      protected void doInTransactionWithoutResult(TransactionStatus status) {
        Person tony = new Person();
        tony.setFirstName("Tony");
        sharedEntityManager.merge(tony);
        Query q = sharedEntityManager.createQuery("select p from Person as p");
View Full Code Here

    factoryControl.replay();
    managerControl.replay();
    txControl.replay();

    try {
      tt.execute(new TransactionCallbackWithoutResult() {
        protected void doInTransactionWithoutResult(TransactionStatus status) {
        }
      });
      fail("Should have thrown InvalidIsolationLevelException");
    }
View Full Code Here

                    "SELECT COUNT(UP_USER.USER_ID) " +
                    "FROM " + joinQueryString.getTestJoin() + " UP_USER.USER_ID=0";
               
                try {
                  transactionTemplate
              .execute(new TransactionCallbackWithoutResult() {
                @Override
                                public void doInTransactionWithoutResult(
                    TransactionStatus status) {
                  jdbcTemplate.getJdbcOperations().execute(
                      joinTestQuery);
View Full Code Here

    // set behavior
    txTemplate.setPropagationBehavior(DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW);
    final String noCommentSql[] = removeCommentsAndSemicolons(connectionModel.getSchema(), sql);
    try {
      // run the code in a transaction
      txTemplate.execute(new TransactionCallbackWithoutResult() {
        public void doInTransactionWithoutResult(TransactionStatus status) {
          jt.batchUpdate(noCommentSql);
        }
      });
    } catch (DataAccessException e) {
View Full Code Here

        assertEquals(new Integer(ITaskInstance.RUNNING), ((IWorkItem) workItemList.get(0)).getState());

        paymentWorkItemId = ((IWorkItem) workItemList.get(0)).getId();
      //---------------------------------------------------------
        System.out.println("--------------Withdraw Payment WorkItem ----------------");
        transactionTemplate.execute(new TransactionCallbackWithoutResult() {

            @Override
            protected void doInTransactionWithoutResult(TransactionStatus arg0) {
                try {
                    IWorkflowSession workflowSession = runtimeContext.getWorkflowSession();
View Full Code Here

        assertEquals(new Integer(ITaskInstance.RUNNING), ((IWorkItem) workItemList.get(0)).getState());

        paymentWorkItemId = ((IWorkItem) workItemList.get(0)).getId();
      //---------------------------------------------------------
        System.out.println("--------------Withdraw Payment WorkItem ----------------");
        transactionTemplate.execute(new TransactionCallbackWithoutResult() {

            @Override
            protected void doInTransactionWithoutResult(TransactionStatus arg0) {
                try {
                    IWorkflowSession workflowSession = runtimeContext.getWorkflowSession();
                    IWorkItem paymentTaskWorkItem = workflowSession.findWorkItemById(paymentWorkItemId);
                    paymentTaskWorkItem.withdraw();
                } catch (EngineException ex) {
                    Logger.getLogger(FireWorkflowEngineTest.class.getName()).log(Level.SEVERE, null, ex);
                    throw new RuntimeException(ex.getMessage());
                } catch (KernelException ex) {
                    Logger.getLogger(FireWorkflowEngineTest.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
      //----------------------------------------------------------
        System.out.println("--------------Complete Payment WorkItem ----------------");
        transactionTemplate.execute(new TransactionCallbackWithoutResult() {

            @Override
            protected void doInTransactionWithoutResult(TransactionStatus arg0) {
                try {
                    IWorkflowSession workflowSession = runtimeContext.getWorkflowSession();
View Full Code Here

TOP

Related Classes of org.springframework.transaction.support.TransactionCallbackWithoutResult

Copyright © 2018 www.massapicom. 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.