Search in sources :

Example 1 with PooledDataSourceFactory

use of io.dropwizard.db.PooledDataSourceFactory in project dropwizard by dropwizard.

the class AbstractLiquibaseCommand method run.

@Override
@SuppressWarnings("UseOfSystemOutOrSystemErr")
protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception {
    final PooledDataSourceFactory dbConfig = strategy.getDataSourceFactory(configuration);
    dbConfig.asSingleConnectionPool();
    try (final CloseableLiquibase liquibase = openLiquibase(dbConfig, namespace)) {
        run(namespace, liquibase);
    } catch (ValidationFailedException e) {
        e.printDescriptiveError(System.err);
        throw e;
    }
}
Also used : ValidationFailedException(liquibase.exception.ValidationFailedException) PooledDataSourceFactory(io.dropwizard.db.PooledDataSourceFactory)

Example 2 with PooledDataSourceFactory

use of io.dropwizard.db.PooledDataSourceFactory in project dropwizard by dropwizard.

the class HibernateBundle method run.

@Override
public final void run(T configuration, Environment environment) throws Exception {
    final PooledDataSourceFactory dbConfig = getDataSourceFactory(configuration);
    this.sessionFactory = sessionFactoryFactory.build(this, environment, dbConfig, entities, name());
    registerUnitOfWorkListerIfAbsent(environment).registerSessionFactory(name(), sessionFactory);
    environment.healthChecks().register(name(), new SessionFactoryHealthCheck(environment.getHealthCheckExecutorService(), dbConfig.getValidationQueryTimeout().orElse(Duration.seconds(5)), sessionFactory, dbConfig.getValidationQuery()));
}
Also used : PooledDataSourceFactory(io.dropwizard.db.PooledDataSourceFactory)

Aggregations

PooledDataSourceFactory (io.dropwizard.db.PooledDataSourceFactory)2 ValidationFailedException (liquibase.exception.ValidationFailedException)1