Package org.springframework.jdbc.datasource

Examples of org.springframework.jdbc.datasource.ConnectionHolder


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


    JpaTransactionObject txObject = (JpaTransactionObject) transaction;
    txObject.setEntityManagerHolder(null, false);
    EntityManagerHolder entityManagerHolder = (EntityManagerHolder)
        TransactionSynchronizationManager.unbindResource(getEntityManagerFactory());
    txObject.setConnectionHolder(null);
    ConnectionHolder connectionHolder = null;
    if (getDataSource() != null && TransactionSynchronizationManager.hasResource(getDataSource())) {
      connectionHolder = (ConnectionHolder) TransactionSynchronizationManager.unbindResource(getDataSource());
    }
    return new SuspendedResourcesHolder(entityManagerHolder, 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 = ((SessionImplementor) 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) {
        Connection con = getJdbcConnection(session);
        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.setSessionHolder(sessionHolder, false);
    }

    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, false);
    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

      }
      txObject.setPersistenceManagerHolder(pmHolder, 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.