Java 类org.hibernate.engine.jdbc.spi.JdbcConnectionAccess 实例源码

项目:lams    文件:LogicalConnectionImpl.java   
/**
 * Constructs a LogicalConnectionImpl
 *
 * @param userSuppliedConnection The user-supplied connection
 * @param connectionReleaseMode The connection release mode to use
 * @param jdbcServices JdbcServices
 * @param jdbcConnectionAccess JDBC Connection access
 */
public LogicalConnectionImpl(
        Connection userSuppliedConnection,
        ConnectionReleaseMode connectionReleaseMode,
        JdbcServices jdbcServices,
        JdbcConnectionAccess jdbcConnectionAccess) {
    this(
            connectionReleaseMode,
            jdbcServices,
            jdbcConnectionAccess,
            (userSuppliedConnection != null),
            false,
            new ArrayList<ConnectionObserver>()
    );
    this.physicalConnection = userSuppliedConnection;
}
项目:lams    文件:LogicalConnectionImpl.java   
/**
 * Constructs a LogicalConnectionImpl.  This for used from deserialization
 */
private LogicalConnectionImpl(
        ConnectionReleaseMode connectionReleaseMode,
        JdbcServices jdbcServices,
        JdbcConnectionAccess jdbcConnectionAccess,
        boolean isUserSuppliedConnection,
        boolean isClosed,
        List<ConnectionObserver> observers) {
    this.connectionReleaseMode = determineConnectionReleaseMode(
            jdbcConnectionAccess, isUserSuppliedConnection, connectionReleaseMode
    );
    this.jdbcServices = jdbcServices;
    this.jdbcConnectionAccess = jdbcConnectionAccess;
    this.observers = observers;

    this.isUserSuppliedConnection = isUserSuppliedConnection;
    this.isClosed = isClosed;
}
项目:lams    文件:LogicalConnectionImpl.java   
private static ConnectionReleaseMode determineConnectionReleaseMode(
        JdbcConnectionAccess jdbcConnectionAccess,
        boolean isUserSuppliedConnection,
        ConnectionReleaseMode connectionReleaseMode) {
    if ( isUserSuppliedConnection ) {
        return ConnectionReleaseMode.ON_CLOSE;
    }
    else if ( connectionReleaseMode == ConnectionReleaseMode.AFTER_STATEMENT &&
            ! jdbcConnectionAccess.supportsAggressiveRelease() ) {
        LOG.debug( "Connection provider reports to not support aggressive release; overriding" );
        return ConnectionReleaseMode.AFTER_TRANSACTION;
    }
    else {
        return connectionReleaseMode;
    }
}
项目:lams    文件:AbstractSessionImpl.java   
@Override
public JdbcConnectionAccess getJdbcConnectionAccess() {
    if ( jdbcConnectionAccess == null ) {
        if ( MultiTenancyStrategy.NONE == factory.getSettings().getMultiTenancyStrategy() ) {
            jdbcConnectionAccess = new NonContextualJdbcConnectionAccess(
                    getEventListenerManager(),
                    factory.getServiceRegistry().getService( ConnectionProvider.class )
            );
        }
        else {
            jdbcConnectionAccess = new ContextualJdbcConnectionAccess(
                    getEventListenerManager(),
                    factory.getServiceRegistry().getService( MultiTenantConnectionProvider.class )
            );
        }
    }
    return jdbcConnectionAccess;
}
项目:lams    文件:SessionFactoryImpl.java   
private JdbcConnectionAccess buildLocalConnectionAccess() {
    return new JdbcConnectionAccess() {
        @Override
        public Connection obtainConnection() throws SQLException {
            return settings.getMultiTenancyStrategy() == MultiTenancyStrategy.NONE
                    ? serviceRegistry.getService( ConnectionProvider.class ).getConnection()
                    : serviceRegistry.getService( MultiTenantConnectionProvider.class ).getAnyConnection();
        }

        @Override
        public void releaseConnection(Connection connection) throws SQLException {
            if ( settings.getMultiTenancyStrategy() == MultiTenancyStrategy.NONE ) {
                serviceRegistry.getService( ConnectionProvider.class ).closeConnection( connection );
            }
            else {
                serviceRegistry.getService( MultiTenantConnectionProvider.class ).releaseAnyConnection( connection );
            }
        }

        @Override
        public boolean supportsAggressiveRelease() {
            return false;
        }
    };
}
项目:lams    文件:JdbcServicesImpl.java   
private JdbcConnectionAccess buildJdbcConnectionAccess(Map configValues) {
    final MultiTenancyStrategy multiTenancyStrategy = MultiTenancyStrategy.determineMultiTenancyStrategy( configValues );

    if ( MultiTenancyStrategy.NONE == multiTenancyStrategy ) {
        connectionProvider = serviceRegistry.getService( ConnectionProvider.class );
        return new ConnectionProviderJdbcConnectionAccess( connectionProvider );
    }
    else {
        connectionProvider = null;
        final MultiTenantConnectionProvider multiTenantConnectionProvider = serviceRegistry.getService( MultiTenantConnectionProvider.class );
        return new MultiTenantConnectionProviderJdbcConnectionAccess( multiTenantConnectionProvider );
    }
}
项目:lams    文件:PersistentTableBulkIdStrategy.java   
@Override
public void prepare(
        JdbcServices jdbcServices,
        JdbcConnectionAccess connectionAccess,
        Mappings mappings,
        Mapping mapping,
        Map settings) {
    this.catalog = ConfigurationHelper.getString(
            CATALOG,
            settings,
            ConfigurationHelper.getString( AvailableSettings.DEFAULT_CATALOG, settings )
    );
    this.schema = ConfigurationHelper.getString(
            SCHEMA,
            settings,
            ConfigurationHelper.getString( AvailableSettings.DEFAULT_SCHEMA, settings )
    );
    this.cleanUpTables = ConfigurationHelper.getBoolean( CLEAN_UP_ID_TABLES, settings, false );

    final Iterator<PersistentClass> entityMappings = mappings.iterateClasses();
    final List<Table> idTableDefinitions = new ArrayList<Table>();
    while ( entityMappings.hasNext() ) {
        final PersistentClass entityMapping = entityMappings.next();
        final Table idTableDefinition = generateIdTableDefinition( entityMapping );
        idTableDefinitions.add( idTableDefinition );
    }
    exportTableDefinitions( idTableDefinitions, jdbcServices, connectionAccess, mappings, mapping );
}
项目:hibernate-dynamic-dialects    文件:SessionFactoryImpl.java   
private JdbcConnectionAccess buildLocalConnectionAccess() {
    return new JdbcConnectionAccess() {
        @Override
        public Connection obtainConnection() throws SQLException {
            return settings.getMultiTenancyStrategy() == MultiTenancyStrategy.NONE ? serviceRegistry
                    .getService(ConnectionProvider.class).getConnection()
                    : serviceRegistry.getService(
                            MultiTenantConnectionProvider.class)
                            .getAnyConnection();
        }

        @Override
        public void releaseConnection(Connection connection)
                throws SQLException {
            if (settings.getMultiTenancyStrategy() == MultiTenancyStrategy.NONE) {
                serviceRegistry.getService(ConnectionProvider.class)
                        .closeConnection(connection);
            } else {
                serviceRegistry.getService(
                        MultiTenantConnectionProvider.class)
                        .releaseAnyConnection(connection);
            }
        }

        @Override
        public boolean supportsAggressiveRelease() {
            return false;
        }
    };
}
项目:lams    文件:JdbcIsolationDelegate.java   
protected JdbcConnectionAccess jdbcConnectionAccess() {
    return transactionCoordinator.getTransactionContext().getJdbcConnectionAccess();
}
项目:lams    文件:JtaIsolationDelegate.java   
protected JdbcConnectionAccess jdbcConnectionAccess() {
    return transactionCoordinator.getTransactionContext().getJdbcConnectionAccess();
}
项目:lams    文件:SessionDelegatorBaseImpl.java   
@Override
public JdbcConnectionAccess getJdbcConnectionAccess() {
    return sessionImplementor.getJdbcConnectionAccess();
}
项目:lams    文件:TemporaryTableBulkIdStrategy.java   
@Override
public void prepare(JdbcServices jdbcServices, JdbcConnectionAccess connectionAccess, Mappings mappings, Mapping mapping, Map settings) {
    // nothing to do
}
项目:lams    文件:TemporaryTableBulkIdStrategy.java   
@Override
public void release(JdbcServices jdbcServices, JdbcConnectionAccess connectionAccess) {
    // nothing to do
}
项目:cte-multi-table-bulk-id-stategy    文件:CTEMultiTableBulkIdStrategy.java   
@Override
public void prepare(JdbcServices jdbcServices,
        JdbcConnectionAccess connectionAccess, Mappings arg2, Mapping arg3,
        Map arg4) {
    // nothing to do
}
项目:cte-multi-table-bulk-id-stategy    文件:CTEMultiTableBulkIdStrategy.java   
@Override
public void release(JdbcServices jdbcServices,
        JdbcConnectionAccess connectionAccess) {
    // nothing to do
}
项目:lams    文件:SessionImplementor.java   
/**
 * Provides access to JDBC connections
 *
 * @return The contract for accessing JDBC connections.
 */
public JdbcConnectionAccess getJdbcConnectionAccess();
项目:lams    文件:MultiTableBulkIdStrategy.java   
/**
 * Prepare the strategy.  Called as the SessionFactory is being built.  Intended patterns here include:<ul>
 *     <li>Adding tables to the passed Mappings, to be picked by by "schema management tools"</li>
 *     <li>Manually creating the tables immediately through the passed JDBC Connection access</li>
 * </ul>
 *
 * @param jdbcServices The JdbcService object
 * @param connectionAccess Access to the JDBC Connection
 * @param mappings The Hibernate Mappings object, for access to O/RM mapping information
 * @param mapping The Hibernate Mapping contract, mainly for use in DDL generation
 * @param settings Configuration settings
 */
public void prepare(JdbcServices jdbcServices, JdbcConnectionAccess connectionAccess, Mappings mappings, Mapping mapping, Map settings);
项目:lams    文件:MultiTableBulkIdStrategy.java   
/**
 * Release the strategy.   Called as the SessionFactory is being shut down.
 *
 * @param jdbcServices The JdbcService object
 * @param connectionAccess Access to the JDBC Connection
 */
public void release(JdbcServices jdbcServices, JdbcConnectionAccess connectionAccess);
项目:lams    文件:TransactionContext.java   
public JdbcConnectionAccess getJdbcConnectionAccess();