Search in sources :

Example 1 with DatasourceConnectionProviderImpl

use of org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl in project ignite by apache.

the class HibernateL2CacheTransactionalSelfTest method registryBuilder.

/** {@inheritDoc} */
@Nullable
@Override
protected StandardServiceRegistryBuilder registryBuilder() {
    StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
    DatasourceConnectionProviderImpl connProvider = new DatasourceConnectionProviderImpl();
    // JTA-aware data source.
    BasicManagedDataSource dataSrc = new BasicManagedDataSource();
    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;
}
Also used : JtaTransactionCoordinatorBuilderImpl(org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) DatasourceConnectionProviderImpl(org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl) JdbcDataSource(org.h2.jdbcx.JdbcDataSource) BasicManagedDataSource(org.apache.commons.dbcp.managed.BasicManagedDataSource) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with DatasourceConnectionProviderImpl

use of org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl in project dropwizard by dropwizard.

the class SessionFactoryFactory method buildConnectionProvider.

private ConnectionProvider buildConnectionProvider(DataSource dataSource, Map<String, String> properties) {
    final DatasourceConnectionProviderImpl connectionProvider = new DatasourceConnectionProviderImpl();
    connectionProvider.setDataSource(dataSource);
    connectionProvider.configure(properties);
    return connectionProvider;
}
Also used : DatasourceConnectionProviderImpl(org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl)

Aggregations

DatasourceConnectionProviderImpl (org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl)2 BasicManagedDataSource (org.apache.commons.dbcp.managed.BasicManagedDataSource)1 JdbcDataSource (org.h2.jdbcx.JdbcDataSource)1 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)1 JtaTransactionCoordinatorBuilderImpl (org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl)1 Nullable (org.jetbrains.annotations.Nullable)1