List of usage examples for org.hibernate.cfg AvailableSettings ISOLATION
String ISOLATION
To view the source code for org.hibernate.cfg AvailableSettings ISOLATION.
Click Source Link
From source file:com.jolbox.bonecp.provider.BoneCPConnectionProvider.java
License:Apache License
/** * Pool configuration./* w ww . jav a 2s .co m*/ * @param props * @throws HibernateException */ public void configure(Properties props) throws HibernateException { try { this.config = new BoneCPConfig(props); // old hibernate config String url = props.getProperty(CONFIG_CONNECTION_URL); String username = props.getProperty(CONFIG_CONNECTION_USERNAME); String password = props.getProperty(CONFIG_CONNECTION_PASSWORD); String driver = props.getProperty(CONFIG_CONNECTION_DRIVER_CLASS); if (url == null) { url = props.getProperty(CONFIG_CONNECTION_URL_ALTERNATE); } if (username == null) { username = props.getProperty(CONFIG_CONNECTION_USERNAME_ALTERNATE); } if (password == null) { password = props.getProperty(CONFIG_CONNECTION_PASSWORD_ALTERNATE); } if (driver == null) { driver = props.getProperty(CONFIG_CONNECTION_DRIVER_CLASS_ALTERNATE); } if (url != null) { this.config.setJdbcUrl(url); } if (username != null) { this.config.setUsername(username); } if (password != null) { this.config.setPassword(password); } // Remember Isolation level this.isolation = ConfigurationHelper.getInteger(AvailableSettings.ISOLATION, props); this.autocommit = ConfigurationHelper.getBoolean(AvailableSettings.AUTOCOMMIT, props); logger.debug(this.config.toString()); if (driver != null && !driver.trim().equals("")) { loadClass(driver); } if (this.config.getConnectionHookClassName() != null) { Object hookClass = loadClass(this.config.getConnectionHookClassName()).newInstance(); this.config.setConnectionHook((ConnectionHook) hookClass); } // create the connection pool this.pool = createPool(this.config); } catch (Exception e) { throw new HibernateException(e); } }
From source file:com.zaxxer.hikari.hibernate.HikariConfigurationUtil.java
License:Apache License
/** * Create/load a HikariConfig from Hibernate properties. * * @param props a map of Hibernate properties * @return a HikariConfig/*from w ww .ja va 2 s .co m*/ */ @SuppressWarnings("rawtypes") public static HikariConfig loadConfiguration(Map props) { Properties hikariProps = new Properties(); copyProperty(AvailableSettings.ISOLATION, props, "transactionIsolation", hikariProps); copyProperty(AvailableSettings.AUTOCOMMIT, props, "autoCommit", hikariProps); copyProperty(AvailableSettings.DRIVER, props, "driverClassName", hikariProps); copyProperty(AvailableSettings.URL, props, "jdbcUrl", hikariProps); copyProperty(AvailableSettings.USER, props, "username", hikariProps); copyProperty(AvailableSettings.PASS, props, "password", hikariProps); for (Object keyo : props.keySet()) { String key = (String) keyo; if (key.startsWith(CONFIG_PREFIX)) { hikariProps.setProperty(key.substring(CONFIG_PREFIX.length()), (String) props.get(key)); } } return new HikariConfig(hikariProps); }
From source file:debop4k.data.orm.spring.boot.autoconfigure.HibernateProperties.java
License:Apache License
@SneakyThrows({ IOException.class }) public Properties toProperties() { Properties props = new Properties(); props.put(AvailableSettings.DIALECT, dialect); props.put(AvailableSettings.HBM2DDL_AUTO, hbm2ddl); props.put(AvailableSettings.SHOW_SQL, showSql); props.put(AvailableSettings.FORMAT_SQL, formatSql); props.put(AvailableSettings.DEFAULT_BATCH_FETCH_SIZE, batchFetchSize); if (Stringx.isNotEmpty(isolation)) { props.put(AvailableSettings.ISOLATION, isolation); }/*from ww w. ja v a 2 s. c o m*/ props.put(AvailableSettings.AUTOCOMMIT, autoCommit); props.put(AvailableSettings.RELEASE_CONNECTIONS, releaseMode); props.put(AvailableSettings.USE_SECOND_LEVEL_CACHE, useSecondCache); props.put(AvailableSettings.CACHE_PROVIDER_CONFIG, cacheProviderConfig.getFile().getAbsolutePath()); return props; }