Search in sources :

Example 26 with DefaultConfiguration

use of org.jooq.impl.DefaultConfiguration in project waltz by khartec.

the class DIBaseConfiguration method dsl.

@Bean
@Autowired
public DSLContext dsl(DataSource dataSource) {
    try {
        SQLDialect.valueOf(dialect);
    } catch (IllegalArgumentException iae) {
        System.err.println("Cannot parse sql dialect: " + dialect);
        throw iae;
    }
    // TODO: remove sql server setting, see #4553
    Settings dslSettings = new Settings().withRenderOutputForSQLServerReturningClause(false);
    if ("true".equals(System.getProperty(JOOQ_DEBUG_PROPERTY))) {
        dslSettings.withRenderFormatted(true).withExecuteLogging(true);
    }
    org.jooq.Configuration configuration = new DefaultConfiguration().set(dataSource).set(SQLDialect.valueOf(dialect)).set(dslSettings).set(new SlowQueryListener(databasePerformanceQuerySlowThreshold)).set(new SpringExceptionTranslationExecuteListener(new SQLStateSQLExceptionTranslator()));
    return DSL.using(configuration);
}
Also used : DefaultConfiguration(org.jooq.impl.DefaultConfiguration) SQLStateSQLExceptionTranslator(org.springframework.jdbc.support.SQLStateSQLExceptionTranslator) Settings(org.jooq.conf.Settings) Autowired(org.springframework.beans.factory.annotation.Autowired) Bean(org.springframework.context.annotation.Bean)

Example 27 with DefaultConfiguration

use of org.jooq.impl.DefaultConfiguration in project commons-dao by reportportal.

the class DatabaseConfiguration method configuration.

@Bean
public DefaultConfiguration configuration() {
    DefaultConfiguration jooqConfiguration = new DefaultConfiguration();
    jooqConfiguration.set(SQLDialect.POSTGRES);
    jooqConfiguration.setConnectionProvider(connectionProvider());
    return jooqConfiguration;
}
Also used : DefaultConfiguration(org.jooq.impl.DefaultConfiguration) JpaRepositoryFactoryBean(org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean) Bean(org.springframework.context.annotation.Bean) LocalContainerEntityManagerFactoryBean(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)

Aggregations

DefaultConfiguration (org.jooq.impl.DefaultConfiguration)27 Settings (org.jooq.conf.Settings)7 Connection (java.sql.Connection)6 Configuration (org.jooq.Configuration)6 DSLContext (org.jooq.DSLContext)6 ConnectionParam (org.simpleflatmapper.db.ConnectionParam)6 Test (org.junit.Test)5 DefaultExecuteListenerProvider (org.jooq.impl.DefaultExecuteListenerProvider)4 SfmRecordMapperProvider (org.simpleflatmapper.jooq.SfmRecordMapperProvider)4 Bean (org.springframework.context.annotation.Bean)4 Properties (java.util.Properties)3 SQLDialect (org.jooq.SQLDialect)3 DataSourceConnectionProvider (org.jooq.impl.DataSourceConnectionProvider)3 DefaultConnectionProvider (org.jooq.impl.DefaultConnectionProvider)3 Provides (dagger.Provides)2 List (java.util.List)2 Singleton (javax.inject.Singleton)2 BasicDataSource (org.apache.commons.dbcp.BasicDataSource)2 ConnectionProvider (org.jooq.ConnectionProvider)2 DbObject (org.simpleflatmapper.test.beans.DbObject)2