Package org.springframework.transaction

Examples of org.springframework.transaction.PlatformTransactionManager


        // 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

          properties.getUrl(),
          properties.getUsername(),
          properties.getPassword(),
          true);
     
      PlatformTransactionManager txnMgr = new DataSourceTransactionManager(ds);
      DBConnectionManager conn = new DBConnectionManager(dataSourceName, ds, txnMgr, null, false);
      return conn;
    }
View Full Code Here

   * @throws IllegalStateException if no matching PlatformTransactionManager bean found
   */
  public static PlatformTransactionManager getTransactionManager(ConfigurableListableBeanFactory bf, String qualifier) {
    Map<String, PlatformTransactionManager> tms =
        BeanFactoryUtils.beansOfTypeIncludingAncestors(bf, PlatformTransactionManager.class);
    PlatformTransactionManager chosen = null;
    for (String beanName : tms.keySet()) {
      if (isQualifierMatch(qualifier, beanName, bf)) {
        if (chosen != null) {
          throw new IllegalStateException("No unique PlatformTransactionManager bean found " +
              "for qualifier '" + qualifier + "'");
View Full Code Here

      if (logger.isDebugEnabled()) {
        logger.debug("Explicit transaction definition [" + transactionDefinition + "] found for test context ["
            + testContext + "]");
      }
      String qualifier = transactionAttribute.getQualifier();
      PlatformTransactionManager tm;
      if (StringUtils.hasLength(qualifier)) {
        // Use autowire-capable factory in order to support extended
        // qualifier matching (only exposed on the internal BeanFactory,
        // not on the ApplicationContext).
        BeanFactory bf = testContext.getApplicationContext().getAutowireCapableBeanFactory();
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

          properties.getUrl(),
          properties.getUsername(),
          properties.getPassword(),
          true);
     
      PlatformTransactionManager txnMgr = new DataSourceTransactionManager(ds);
      DBConnectionManager conn = new DBConnectionManager(dataSourceName, ds, txnMgr, null, false);
      return conn;
    }
View Full Code Here

            container.setRecoveryInterval(recoveryInterval);
        }
        if (taskExecutor != null) {
            container.setTaskExecutor(taskExecutor);
        }
        PlatformTransactionManager tm = getTransactionManager();
        if (tm != null) {
            container.setTransactionManager(tm);
        } else if (transacted) {
            throw new IllegalArgumentException("Property transacted is enabled but a transactionManager was not injected!");
        }
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.