Package org.springframework.jdbc.datasource

Examples of org.springframework.jdbc.datasource.ConnectionHolder


      // Register the JDO PersistenceManager's JDBC Connection for the DataSource, if set.
      if (getDataSource() != null) {
        ConnectionHandle conHandle = getJdoDialect().getJdbcConnection(pm, definition.isReadOnly());
        if (conHandle != null) {
          ConnectionHolder conHolder = new ConnectionHolder(conHandle);
          if (timeout != TransactionDefinition.TIMEOUT_DEFAULT) {
            conHolder.setTimeoutInSeconds(timeout);
          }
          if (logger.isDebugEnabled()) {
            logger.debug("Exposing JDO transaction as JDBC transaction [" + conHolder.getConnectionHandle() + "]");
          }
          TransactionSynchronizationManager.bindResource(getDataSource(), conHolder);
          txObject.setConnectionHolder(conHolder);
        }
        else {
View Full Code Here


    JdoTransactionObject txObject = (JdoTransactionObject) transaction;
    txObject.setPersistenceManagerHolder(null, false);
    PersistenceManagerHolder persistenceManagerHolder = (PersistenceManagerHolder)
        TransactionSynchronizationManager.unbindResource(getPersistenceManagerFactory());
    txObject.setConnectionHolder(null);
    ConnectionHolder connectionHolder = null;
    if (getDataSource() != null && TransactionSynchronizationManager.hasResource(getDataSource())) {
      connectionHolder = (ConnectionHolder) TransactionSynchronizationManager.unbindResource(getDataSource());
    }
    return new SuspendedResourcesHolder(persistenceManagerHolder, connectionHolder);
  }
View Full Code Here

      }
      txObject.setPersistenceManagerHolder(pmHolder, false);
    }

    if (getDataSource() != null) {
      ConnectionHolder conHolder = (ConnectionHolder)
          TransactionSynchronizationManager.getResource(getDataSource());
      txObject.setConnectionHolder(conHolder);
    }

    return txObject;
View Full Code Here

      // Register the JDO PersistenceManager's JDBC Connection for the DataSource, if set.
      if (getDataSource() != null) {
        ConnectionHandle conHandle = getJdoDialect().getJdbcConnection(pm, definition.isReadOnly());
        if (conHandle != null) {
          ConnectionHolder conHolder = new ConnectionHolder(conHandle);
          if (timeout != TransactionDefinition.TIMEOUT_DEFAULT) {
            conHolder.setTimeoutInSeconds(timeout);
          }
          if (logger.isDebugEnabled()) {
            logger.debug("Exposing JDO transaction as JDBC transaction [" + conHolder.getConnectionHandle() + "]");
          }
          TransactionSynchronizationManager.bindResource(getDataSource(), conHolder);
          txObject.setConnectionHolder(conHolder);
        }
        else {
View Full Code Here

    JdoTransactionObject txObject = (JdoTransactionObject) transaction;
    txObject.setPersistenceManagerHolder(null, false);
    PersistenceManagerHolder persistenceManagerHolder = (PersistenceManagerHolder)
        TransactionSynchronizationManager.unbindResource(getPersistenceManagerFactory());
    txObject.setConnectionHolder(null);
    ConnectionHolder connectionHolder = null;
    if (getDataSource() != null && TransactionSynchronizationManager.hasResource(getDataSource())) {
      connectionHolder = (ConnectionHolder) TransactionSynchronizationManager.unbindResource(getDataSource());
    }
    return new SuspendedResourcesHolder(persistenceManagerHolder, connectionHolder);
  }
View Full Code Here

            "Could not obtain Hibernate-managed Session for Spring-managed transaction", ex);
      }
    }

    if (getDataSource() != null) {
      ConnectionHolder conHolder = (ConnectionHolder)
          TransactionSynchronizationManager.getResource(getDataSource());
      txObject.setConnectionHolder(conHolder);
    }

    return txObject;
View Full Code Here

      txObject.getSessionHolder().setTransaction(hibTx);

      // Register the Hibernate Session's JDBC Connection for the DataSource, if set.
      if (getDataSource() != null) {
        Connection con = session.connection();
        ConnectionHolder conHolder = new ConnectionHolder(con);
        if (timeout != TransactionDefinition.TIMEOUT_DEFAULT) {
          conHolder.setTimeoutInSeconds(timeout);
        }
        if (logger.isDebugEnabled()) {
          logger.debug("Exposing Hibernate transaction as JDBC transaction [" + con + "]");
        }
        TransactionSynchronizationManager.bindResource(getDataSource(), conHolder);
View Full Code Here

    HibernateTransactionObject txObject = (HibernateTransactionObject) transaction;
    txObject.setSessionHolder(null);
    SessionHolder sessionHolder =
        (SessionHolder) TransactionSynchronizationManager.unbindResource(getSessionFactory());
    txObject.setConnectionHolder(null);
    ConnectionHolder connectionHolder = null;
    if (getDataSource() != null) {
      connectionHolder = (ConnectionHolder) TransactionSynchronizationManager.unbindResource(getDataSource());
    }
    return new SuspendedResourcesHolder(sessionHolder, connectionHolder);
  }
View Full Code Here

      // Register the TopLink Session's JDBC Connection for the DataSource, if set.
      if (getDataSource() != null) {
        Session mostSpecificSession = (!definition.isReadOnly() ? session.getActiveUnitOfWork() : session);
        Connection con = getJdbcConnection(mostSpecificSession);
        if (con != null) {
          ConnectionHolder conHolder = new ConnectionHolder(con);
          if (timeout != TransactionDefinition.TIMEOUT_DEFAULT) {
            conHolder.setTimeoutInSeconds(timeout);
          }
          if (logger.isDebugEnabled()) {
            logger.debug("Exposing TopLink transaction as JDBC transaction [" + con + "]");
          }
          TransactionSynchronizationManager.bindResource(getDataSource(), conHolder);
View Full Code Here

      }
      txObject.setEntityManagerHolder(emHolder, false);
    }

    if (getDataSource() != null) {
      ConnectionHolder conHolder = (ConnectionHolder)
          TransactionSynchronizationManager.getResource(getDataSource());
      txObject.setConnectionHolder(conHolder);
    }

    return txObject;
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.datasource.ConnectionHolder

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.