Java Code Examples for org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl#configure()

The following examples show how to use org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl#configure() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SchemaMultitenancyTest.java    From high-performance-java-persistence with Apache License 2.0 5 votes vote down vote up
private void addTenantConnectionProvider(String tenantId, DataSource tenantDataSource, Properties properties) {
    DatasourceConnectionProviderImpl connectionProvider = new DatasourceConnectionProviderImpl();
    connectionProvider.setDataSource(tenantDataSource);
    connectionProvider.configure(properties);
    MultiTenantConnectionProvider.INSTANCE.getConnectionProviderMap().put(
            tenantId, connectionProvider
    );
}
 
Example 2
Source File: CatalogMultitenancyTest.java    From high-performance-java-persistence with Apache License 2.0 5 votes vote down vote up
private void addTenantConnectionProvider(String tenantId, DataSource tenantDataSource, Properties properties) {
    DatasourceConnectionProviderImpl connectionProvider = new DatasourceConnectionProviderImpl();
    connectionProvider.setDataSource(tenantDataSource);
    connectionProvider.configure(properties);
    MultiTenantConnectionProvider.INSTANCE.getConnectionProviderMap().put(
            tenantId, connectionProvider
    );
}
 
Example 3
Source File: HibernateL2CacheTransactionalSelfTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Nullable @Override protected StandardServiceRegistryBuilder registryBuilder() {
    StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();

    DatasourceConnectionProviderImpl connProvider = new DatasourceConnectionProviderImpl();

    BasicManagedDataSource dataSrc = new BasicManagedDataSource(); // JTA-aware data source.

    dataSrc.setTransactionManager(jotm.getTransactionManager());

    dataSrc.setDefaultAutoCommit(false);

    JdbcDataSource h2DataSrc = new JdbcDataSource();

    h2DataSrc.setURL(CONNECTION_URL);

    dataSrc.setXaDataSourceInstance(h2DataSrc);

    connProvider.setDataSource(dataSrc);

    connProvider.configure(Collections.emptyMap());

    builder.addService(ConnectionProvider.class, connProvider);

    builder.addService(JtaPlatform.class, new TestJtaPlatform());

    builder.applySetting(Environment.TRANSACTION_COORDINATOR_STRATEGY, JtaTransactionCoordinatorBuilderImpl.class.getName());

    return builder;
}
 
Example 4
Source File: HibernateL2CacheTransactionalSelfTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Nullable @Override protected StandardServiceRegistryBuilder registryBuilder() {
    StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();

    DatasourceConnectionProviderImpl connProvider = new DatasourceConnectionProviderImpl();

    BasicManagedDataSource dataSrc = new BasicManagedDataSource(); // JTA-aware data source.

    dataSrc.setTransactionManager(jotm.getTransactionManager());

    dataSrc.setDefaultAutoCommit(false);

    JdbcDataSource h2DataSrc = new JdbcDataSource();

    h2DataSrc.setURL(CONNECTION_URL);

    dataSrc.setXaDataSourceInstance(h2DataSrc);

    connProvider.setDataSource(dataSrc);

    connProvider.configure(Collections.emptyMap());

    builder.addService(ConnectionProvider.class, connProvider);

    builder.addService(JtaPlatform.class, new TestJtaPlatform());

    builder.applySetting(Environment.TRANSACTION_COORDINATOR_STRATEGY, JtaTransactionCoordinatorBuilderImpl.class.getName());

    return builder;
}