Example usage for org.hibernate.jpa AvailableSettings JDBC_USER

List of usage examples for org.hibernate.jpa AvailableSettings JDBC_USER

Introduction

In this page you can find the example usage for org.hibernate.jpa AvailableSettings JDBC_USER.

Prototype

String JDBC_USER

To view the source code for org.hibernate.jpa AvailableSettings JDBC_USER.

Click Source Link

Usage

From source file:de.ks.persistence.connection.ConnectionProvider.java

License:Apache License

protected PoolProperties createProperties(Map<String, String> configurationValues) {
    String jdbcUrl = (String) configurationValues.get(AvailableSettings.JDBC_URL);
    String driver = (String) configurationValues.get(AvailableSettings.JDBC_DRIVER);
    String user = (String) configurationValues.get(AvailableSettings.JDBC_USER);
    String pw = (String) configurationValues.get(AvailableSettings.JDBC_PASSWORD);
    log.info("Configuring pool with\n\tjdcburl={}\n\tdriver={}", jdbcUrl, driver);

    PoolProperties p = new PoolProperties();
    p.setUrl(jdbcUrl);/*from   w  w  w.ja v a 2s . c  o m*/
    p.setDriverClassName(driver);
    p.setUsername(user);
    p.setPassword(pw);
    p.setJmxEnabled(false);
    p.setTestWhileIdle(false);
    p.setTestOnBorrow(true);
    p.setValidationQuery("SELECT 1");
    p.setTestOnReturn(false);
    p.setValidationInterval(30000);
    p.setTimeBetweenEvictionRunsMillis(30000);
    p.setMaxActive(100);
    p.setInitialSize(10);
    p.setMaxWait(10000);
    p.setRemoveAbandonedTimeout(60);
    p.setMinEvictableIdleTimeMillis(30000);
    p.setMinIdle(10);
    p.setLogAbandoned(true);
    p.setRemoveAbandoned(true);
    p.setDefaultAutoCommit(false);
    p.setJdbcInterceptors("org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;"
            + "org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer");
    return p;
}