Example usage for org.hibernate.cfg AvailableSettings C3P0_TIMEOUT

List of usage examples for org.hibernate.cfg AvailableSettings C3P0_TIMEOUT

Introduction

In this page you can find the example usage for org.hibernate.cfg AvailableSettings C3P0_TIMEOUT.

Prototype

String C3P0_TIMEOUT

To view the source code for org.hibernate.cfg AvailableSettings C3P0_TIMEOUT.

Click Source Link

Document

Maximum idle time for C3P0 connection pool

Usage

From source file:com.flipkart.fdp.migration.db.DBInitializer.java

License:Apache License

private Properties getHibernateProperties() {
    Properties properties = new Properties();
    properties.put(DRIVER, config.getDbDriver());
    properties.put(USER, config.getDbUserName());
    properties.put(PASS, config.getDbUserPassword());
    properties.put(URL, config.getDbConnectionURL());
    properties.put(DIALECT, config.getDbDialect());
    // "org.hibernate.dialect.MySQL5Dialect"
    properties.put(SHOW_SQL, "false");
    properties.put(HBM2DDL_AUTO, "update");
    properties.put(CURRENT_SESSION_CONTEXT_CLASS, "thread");
    // properties.put("current_session_context_class", "thread");
    properties.put(RELEASE_CONNECTIONS, "after_transaction");

    properties.put(POOL_SIZE, 10);/*from   w w  w  .j  a v a2s .c  om*/
    properties.put(org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER,
            "org.hibernate.connection.C3P0ConnectionProvider");
    properties.put(org.hibernate.cfg.AvailableSettings.C3P0_MAX_SIZE, 100);
    properties.put(org.hibernate.cfg.AvailableSettings.C3P0_MIN_SIZE, 5);
    properties.put(org.hibernate.cfg.AvailableSettings.C3P0_MAX_STATEMENTS, 0);
    properties.put(org.hibernate.cfg.AvailableSettings.C3P0_ACQUIRE_INCREMENT, 1);
    properties.put(org.hibernate.cfg.AvailableSettings.C3P0_IDLE_TEST_PERIOD, 100);
    properties.put(org.hibernate.cfg.AvailableSettings.C3P0_TIMEOUT, 100);

    return properties;
}