Package org.hibernate.engine.jdbc.connections.spi

Examples of org.hibernate.engine.jdbc.connections.spi.ConnectionProvider


          },
          sqlStatementLogger
      );
    }

    final ConnectionProvider connectionProvider = serviceRegistry.getService( ConnectionProvider.class );
    if ( connectionProvider != null ) {
      return new JdbcConnectionContext(
          new JdbcConnectionAccess() {
            @Override
            public Connection obtainConnection() throws SQLException {
              return connectionProvider.getConnection();
            }

            @Override
            public void releaseConnection(Connection connection) throws SQLException {
              connectionProvider.closeConnection( connection );
            }

            @Override
            public boolean supportsAggressiveRelease() {
              return connectionProvider.supportsAggressiveRelease();
            }
          },
          sqlStatementLogger
      );
    }
View Full Code Here


      return null;
    }

    final StrategySelector strategySelector = registry.getService( StrategySelector.class );

    ConnectionProvider connectionProvider = null;
    final String providerName = getConfiguredConnectionProviderName( configurationValues );
    if ( providerName != null ) {
      connectionProvider = instantiateExplicitConnectionProvider( providerName, strategySelector );
    }
    else if ( configurationValues.get( Environment.DATASOURCE ) != null ) {
      connectionProvider = new DatasourceConnectionProviderImpl();
    }

    if ( connectionProvider == null ) {
      if ( c3p0ConfigDefined( configurationValues ) ) {
        connectionProvider = instantiateC3p0Provider( strategySelector );
      }
    }

    if ( connectionProvider == null ) {
      if ( proxoolConfigDefined( configurationValues ) ) {
        connectionProvider = instantiateProxoolProvider( strategySelector );
      }
    }

    if ( connectionProvider == null ) {
      if ( configurationValues.get( Environment.URL ) != null ) {
        connectionProvider = new DriverManagerConnectionProviderImpl();
      }
    }

    if ( connectionProvider == null ) {
      LOG.noAppropriateConnectionProvider();
      connectionProvider = new UserSuppliedConnectionProviderImpl();
    }


    final Map injectionData = (Map) configurationValues.get( INJECTION_DATA );
    if ( injectionData != null && injectionData.size() > 0 ) {
      final ConnectionProvider theConnectionProvider = connectionProvider;
      new BeanInfoHelper( connectionProvider.getClass() ).applyToBeanInfo(
          connectionProvider,
          new BeanInfoHelper.BeanInfoDelegate() {
            public void processBeanInfo(BeanInfo beanInfo) throws Exception {
              final PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
View Full Code Here

    if ( providedConnection != null ) {
      return new JdbcConnectionContext( new ProvidedJdbcConnectionAccess( providedConnection ), sqlStatementLogger );
    }

    final ConnectionProvider connectionProvider = serviceRegistry.getService( ConnectionProvider.class );
    if ( connectionProvider != null ) {
      return new JdbcConnectionContext( new ConnectionProviderJdbcConnectionAccess( connectionProvider ), sqlStatementLogger );
    }

    // otherwise, return a no-op impl
View Full Code Here

          },
          sqlStatementLogger
      );
    }

    final ConnectionProvider connectionProvider = serviceRegistry.getService( ConnectionProvider.class );
    if ( connectionProvider != null ) {
      return new JdbcConnectionContext(
          new JdbcConnectionAccess() {
            @Override
            public Connection obtainConnection() throws SQLException {
              return connectionProvider.getConnection();
            }

            @Override
            public void releaseConnection(Connection connection) throws SQLException {
              connectionProvider.closeConnection( connection );
            }

            @Override
            public boolean supportsAggressiveRelease() {
              return connectionProvider.supportsAggressiveRelease();
            }
          },
          sqlStatementLogger
      );
    }
View Full Code Here

          },
          sqlStatementLogger
      );
    }

    final ConnectionProvider connectionProvider = serviceRegistry.getService( ConnectionProvider.class );
    if ( connectionProvider != null ) {
      return new JdbcConnectionContext(
          new JdbcConnectionAccess() {
            @Override
            public Connection obtainConnection() throws SQLException {
              return connectionProvider.getConnection();
            }

            @Override
            public void releaseConnection(Connection connection) throws SQLException {
              connectionProvider.closeConnection( connection );
            }

            @Override
            public boolean supportsAggressiveRelease() {
              return connectionProvider.supportsAggressiveRelease();
            }
          },
          sqlStatementLogger
      );
    }
View Full Code Here

    public SessionFactory build(HibernateBundle<?> bundle,
                                Environment environment,
                                DataSourceFactory dbConfig,
                                ManagedDataSource dataSource,
                                List<Class<?>> entities) {
        final ConnectionProvider provider = buildConnectionProvider(dataSource,
                                                                    dbConfig.getProperties());
        final SessionFactory factory = buildSessionFactory(bundle,
                                                           dbConfig,
                                                           provider,
                                                           dbConfig.getProperties(),
View Full Code Here

      return null;
    }

    final StrategySelector strategySelector = registry.getService( StrategySelector.class );

    ConnectionProvider connectionProvider = null;
    final String providerName = getConfiguredConnectionProviderName( configurationValues );
    if ( providerName != null ) {
      connectionProvider = instantiateExplicitConnectionProvider( providerName, strategySelector );
    }
    else if ( configurationValues.get( Environment.DATASOURCE ) != null ) {
      connectionProvider = new DatasourceConnectionProviderImpl();
    }

    if ( connectionProvider == null ) {
      if ( c3p0ConfigDefined( configurationValues ) ) {
        connectionProvider = instantiateC3p0Provider( strategySelector );
      }
    }

    if ( connectionProvider == null ) {
      if ( proxoolConfigDefined( configurationValues ) ) {
        connectionProvider = instantiateProxoolProvider( strategySelector );
      }
    }

    if ( connectionProvider == null ) {
      if ( configurationValues.get( Environment.URL ) != null ) {
        connectionProvider = new DriverManagerConnectionProviderImpl();
      }
    }

    if ( connectionProvider == null ) {
      LOG.noAppropriateConnectionProvider();
      connectionProvider = new UserSuppliedConnectionProviderImpl();
    }


    final Map injectionData = (Map) configurationValues.get( INJECTION_DATA );
    if ( injectionData != null && injectionData.size() > 0 ) {
      final ConnectionProvider theConnectionProvider = connectionProvider;
      new BeanInfoHelper( connectionProvider.getClass() ).applyToBeanInfo(
          connectionProvider,
          new BeanInfoHelper.BeanInfoDelegate() {
            public void processBeanInfo(BeanInfo beanInfo) throws Exception {
              final PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
View Full Code Here

    if ( providedConnection != null ) {
      return new JdbcConnectionContext( new ProvidedJdbcConnectionAccess( providedConnection ), sqlStatementLogger );
    }

    final ConnectionProvider connectionProvider = serviceRegistry.getService( ConnectionProvider.class );
    if ( connectionProvider != null ) {
      return new JdbcConnectionContext( new ConnectionProviderJdbcConnectionAccess( connectionProvider ), sqlStatementLogger );
    }

    // otherwise, return a no-op impl
View Full Code Here

      return null;
    }

    final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );

    ConnectionProvider connectionProvider = null;
    String providerClassName = getConfiguredConnectionProviderName( configurationValues );
    if ( providerClassName != null ) {
      connectionProvider = instantiateExplicitConnectionProvider( providerClassName, classLoaderService );
    }
    else if ( configurationValues.get( Environment.DATASOURCE ) != null ) {
      connectionProvider = new DatasourceConnectionProviderImpl();
    }

    if ( connectionProvider == null ) {
      if ( c3p0ConfigDefined( configurationValues ) && c3p0ProviderPresent( classLoaderService ) ) {
        connectionProvider = instantiateExplicitConnectionProvider( C3P0_PROVIDER_CLASS_NAME,
            classLoaderService
        );
      }
    }

    if ( connectionProvider == null ) {
      if ( proxoolConfigDefined( configurationValues ) && proxoolProviderPresent( classLoaderService ) ) {
        connectionProvider = instantiateExplicitConnectionProvider( PROXOOL_PROVIDER_CLASS_NAME,
            classLoaderService
        );
      }
    }

    if ( connectionProvider == null ) {
      if ( configurationValues.get( Environment.URL ) != null ) {
        connectionProvider = new DriverManagerConnectionProviderImpl();
      }
    }

    if ( connectionProvider == null ) {
            LOG.noAppropriateConnectionProvider();
      connectionProvider = new UserSuppliedConnectionProviderImpl();
    }


    final Map injectionData = (Map) configurationValues.get( INJECTION_DATA );
    if ( injectionData != null && injectionData.size() > 0 ) {
      final ConnectionProvider theConnectionProvider = connectionProvider;
      new BeanInfoHelper( connectionProvider.getClass() ).applyToBeanInfo(
          connectionProvider,
          new BeanInfoHelper.BeanInfoDelegate() {
            public void processBeanInfo(BeanInfo beanInfo) throws Exception {
              PropertyDescriptor[] descritors = beanInfo.getPropertyDescriptors();
View Full Code Here

  }

  private static DataSource getDataSource(SessionFactory sessionFactory) {
    if (sessionFactory instanceof SessionFactoryImpl) {
      ConnectionProvider cp = ((SessionFactoryImpl) sessionFactory).getConnectionProvider();
      if (cp instanceof DatasourceConnectionProviderImpl) {
        return ((DatasourceConnectionProviderImpl) cp).getDataSource();
      }
    }
    return null;
View Full Code Here

TOP

Related Classes of org.hibernate.engine.jdbc.connections.spi.ConnectionProvider

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.