Package org.springframework.transaction

Examples of org.springframework.transaction.PlatformTransactionManager


      };
    }

    TransactionStatus status = null;
    if (txAttr != null) {
      PlatformTransactionManager tm = getTransactionManager();
      if (tm != null) {
        status = tm.getTransaction(txAttr);
      }
      else {
        if (logger.isDebugEnabled()) {
          logger.debug("Skipping transactional joinpoint [" + joinpointIdentification +
              "] because no transaction manager has been configured");
View Full Code Here


            // There is no guaranteed way of determining whether a transaction is active or not
            // under spring. So we try to join the existing one, and if we can't, it's not active
            // (We could inspect the transaction data stack for the thread, but this isn't guaranteed
            // if the user has created transactions for themselves)
            try {
                PlatformTransactionManager qq_txn1 = pDataSource.getTransactionManager();
                TransactionStatus aTxnStatus = qq_txn1.getTransaction(new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_MANDATORY));
                qq_txn1.commit(aTxnStatus);
                return true;
            }
            catch (Exception e) {
                return false;
            }
View Full Code Here

        // so ignore them unless they are the only transaction on the stack (in which case they
        // should be flagged as INDEPENDENT transaction, but it doesn't hurt to check)
        // TF:27/04/2008:Changed the check of the size to 0, as we've popped the top of the stack
        if (transactionData.type != TransactionType.NESTED || currentTransactions.size() == 0) {
            TransactionStatus currentStatus = transactionData.getStatus();
            PlatformTransactionManager aTxn = transactionData.getManager();
            if (currentStatus != null && aTxn != null) {
                _log.debug("Rollback Transaction: " + transactionData);
                aTxn.rollback(currentStatus);
            }
        }
        // We must flag all transactions to be rolled back. This is necessary because there is
        // no guarantee we have actually started the transaction, so we may not be able to mark
        // it as being only able to be rolled back.
View Full Code Here

        // so ignore them unless they are the only transaction on the stack (in which case they
        // should be flagged as INDEPENDENT transaction, but it doesn't hurt to check)
        // TF:27/04/2008:Changed the check of the size to 0, as we've popped the top of the stack
        if (transactionData.type != TransactionType.NESTED || currentTransactions.size() == 0) {
            TransactionStatus currentStatus = transactionData.getStatus();
            PlatformTransactionManager aTxn = transactionData.getManager();
            if (aTxn != null && currentStatus != null) {
                if (transactionData.rolledBack) {
                    // Something has previously rolled back, forcing this transaction to rollback
                  if (_log.isDebugEnabled()) {
                    _log.debug("Commit Transaction (will rollback): " + transactionData);
                  }
                    aTxn.rollback(currentStatus);
                    statistics.incrementRollbackCount();
                }
                else {
                  if (_log.isDebugEnabled()) {
                    _log.debug("Commit Transaction: " + transactionData);
                  }
                    aTxn.commit(currentStatus);
                    statistics.incrementCommitCount();
                }
            }
            else {
                statistics.incrementCommitCount();
View Full Code Here

   */
  public void setBeanFactory(BeanFactory beanFactory) {
    if (this.transactionInterceptor.getTransactionManager() == null &&
        beanFactory instanceof ListableBeanFactory) {
      ListableBeanFactory lbf = (ListableBeanFactory) beanFactory;
      PlatformTransactionManager ptm = (PlatformTransactionManager)
          BeanFactoryUtils.beanOfTypeIncludingAncestors(lbf, PlatformTransactionManager.class);
      this.transactionInterceptor.setTransactionManager(ptm);
    }
  }
View Full Code Here

      };
    }

    TransactionStatus status = null;
    if (txAttr != null) {
      PlatformTransactionManager tm = getTransactionManager();
      if (tm != null) {
        status = tm.getTransaction(txAttr);
      }
      else {
        if (logger.isDebugEnabled()) {
          logger.debug("Skipping transactional joinpoint [" + joinpointIdentification +
              "] because no transaction manager has been configured");
View Full Code Here

      };
    }

    TransactionStatus status = null;
    if (txAttr != null) {
      PlatformTransactionManager tm = getTransactionManager();
      Assert.state(tm != null, "Property 'transactionManager' must be set on transaction aspect");
      status = tm.getTransaction(txAttr);
    }
    return prepareTransactionInfo(txAttr, joinpointIdentification, status);
  }
View Full Code Here

                inMessage = inMessage.getExchange().getInMessage();
            }
            //need to propagate any exceptions back to Spring container
            //so transactions can occur
            if (inMessage.getContent(Exception.class) != null && session != null) {
                PlatformTransactionManager m = jmsConfig.getTransactionManager();
                if (m != null) {
                    TransactionStatus status = m.getTransaction(null);
                    JmsResourceHolder resourceHolder =
                        (JmsResourceHolder) TransactionSynchronizationManager
                            .getResource(jmsConfig.getConnectionFactory());
                    boolean trans = resourceHolder == null
                        || !resourceHolder.containsSession(session);
View Full Code Here

                inMessage = inMessage.getExchange().getInMessage();
            }
            //need to propagate any exceptions back to Spring container
            //so transactions can occur
            if (inMessage.getContent(Exception.class) != null && session != null) {
                PlatformTransactionManager m = jmsConfig.getTransactionManager();
                if (m != null) {
                    TransactionStatus status = m.getTransaction(null);
                    JmsResourceHolder resourceHolder =
                        (JmsResourceHolder) TransactionSynchronizationManager
                            .getResource(jmsConfig.getConnectionFactory());
                    boolean trans = resourceHolder == null
                        || !resourceHolder.containsSession(session);
View Full Code Here

    txControl.setVoidCallable(1);
    pmfControl.replay();
    pmControl.replay();
    txControl.replay();

    PlatformTransactionManager tm = new JdoTransactionManager(pmf);
    TransactionTemplate tt = new TransactionTemplate(tm);
    final List l = new ArrayList();
    l.add("test");
    assertTrue("Hasn't thread pm", !TransactionSynchronizationManager.hasResource(pmf));
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());
View Full Code Here

TOP

Related Classes of org.springframework.transaction.PlatformTransactionManager

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.