public void configure(Type type, Properties params, Dialect d) { sep = PropertiesHelper.getString("separator", params, ""); }
public void configure(Type type, Properties params, Dialect dialect) throws MappingException { tableName = PropertiesHelper.getString(ID_TABLE, params, DEFAULT_TABLE); pkColumnName = PropertiesHelper.getString(PK_COLUMN_NAME, params, DEFAULT_PK_COLUMN); valueColumnName = PropertiesHelper.getString(VALUE_COLUMN_NAME, params, DEFAULT_VALUE_COLUMN); initialHi = PropertiesHelper.getInt(INITIAL_HI, params, DEFAULT_INITIAL_HI); String schemaName = params.getProperty(SCHEMA); String catalogName = params.getProperty(CATALOG); keySize = PropertiesHelper.getInt(PK_LENGTH_NAME, params, DEFAULT_PK_LENGTH); keyValue = PropertiesHelper.getString(PK_VALUE_NAME, params, params.getProperty(TABLE)); maxLo = PropertiesHelper.getInt(MAX_LO, params, Short.MAX_VALUE); lo = maxLo + 1; // so we "clock over" on the first invocation returnClass = type.getReturnedClass();
public static String[] toStringArray(String property, String delim, Properties properties) { return toStringArray( properties.getProperty(property), delim ); }
boolean flushBeforeCompletion = PropertiesHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties); log.info("Automatic flush during beforeCompletion(): " + enabledDisabled(flushBeforeCompletion) ); settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion); boolean autoCloseSession = PropertiesHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties); log.info("Automatic session close at end of transaction: " + enabledDisabled(autoCloseSession) ); settings.setAutoCloseSessionEnabled(autoCloseSession); int batchSize = PropertiesHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0); if ( !metaSupportsBatchUpdates ) batchSize = 0; if (batchSize>0) log.info("JDBC batch size: " + batchSize); settings.setJdbcBatchSize(batchSize); boolean jdbcBatchVersionedData = PropertiesHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false); if (batchSize>0) log.info("JDBC batch updates for versioned data: " + enabledDisabled(jdbcBatchVersionedData) ); settings.setJdbcBatchVersionedData(jdbcBatchVersionedData); settings.setBatcherFactory( createBatcherFactory(properties, batchSize) ); boolean useScrollableResultSets = PropertiesHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, metaSupportsScrollable); log.info("Scrollable result sets: " + enabledDisabled(useScrollableResultSets) ); settings.setScrollableResultSetsEnabled(useScrollableResultSets); boolean wrapResultSets = PropertiesHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false); log.debug( "Wrap result sets: " + enabledDisabled(wrapResultSets) ); settings.setWrapResultSetsEnabled(wrapResultSets); boolean useGetGeneratedKeys = PropertiesHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, metaSupportsGetGeneratedKeys); log.info("JDBC3 getGeneratedKeys(): " + enabledDisabled(useGetGeneratedKeys) ); settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);
poolSize = PropertiesHelper.getInt(Environment.POOL_SIZE, props, 20); //default pool size 20 log.info("Using Hibernate built-in connection pool (not for production use!)"); log.info("Hibernate connection pool size: " + poolSize); autocommit = PropertiesHelper.getBoolean(Environment.AUTOCOMMIT, props); log.info("autocommit mode: " + autocommit); isolation = PropertiesHelper.getInteger(Environment.ISOLATION, props); if (isolation!=null) log.info( "JDBC isolation level: " + Environment.isolationLevelToString( isolation.intValue() ) ); log.info( "connection properties: " + PropertiesHelper.maskOut(connectionProps, "password") );
log.info( "Connection properties: " + PropertiesHelper.maskOut(connectionProps, "password") ); autocommit = PropertiesHelper.getBoolean(Environment.AUTOCOMMIT, props); log.info("autocommit mode: " + autocommit); int minPoolSize = PropertiesHelper.getInt(Environment.C3P0_MIN_SIZE, props, 1); int maxPoolSize = PropertiesHelper.getInt(Environment.C3P0_MAX_SIZE, props, 100); int maxIdleTime = PropertiesHelper.getInt(Environment.C3P0_TIMEOUT, props, 0); int maxStatements = PropertiesHelper.getInt(Environment.C3P0_MAX_STATEMENTS, props, 0); int acquireIncrement = PropertiesHelper.getInt(Environment.C3P0_ACQUIRE_INCREMENT, props, 1); int idleTestPeriod = PropertiesHelper.getInt(Environment.C3P0_IDLE_TEST_PERIOD, props, 0);
public void configure(Type type, Properties params, Dialect d) throws MappingException { super.configure(type, params, d); maxLo = PropertiesHelper.getInt(MAX_LO, params, 9); lo = maxLo + 1; // so we "clock over" on the first invocation returnClass = type.getReturnedClass(); }
/** * Builds a new {@link Cache} instance, and gets it's properties from the OSCache {@link Config} * which reads the properties file (<code>oscache.properties</code>) from the classpath. * If the file cannot be found or loaded, an the defaults are used. * * @param region * @param properties * @return * @throws CacheException */ public Cache buildCache(String region, Properties properties) throws CacheException { int refreshPeriod = PropertiesHelper.getInt( StringHelper.qualify(region, OSCACHE_REFRESH_PERIOD), OSCACHE_PROPERTIES, CacheEntry.INDEFINITE_EXPIRY ); String cron = OSCACHE_PROPERTIES.getProperty( StringHelper.qualify(region, OSCACHE_CRON) ); // construct the cache final OSCache cache = new OSCache(refreshPeriod, cron, region); Integer capacity = PropertiesHelper.getInteger( StringHelper.qualify(region, OSCACHE_CAPACITY), OSCACHE_PROPERTIES ); if ( capacity!=null ) cache.setCacheCapacity( capacity.intValue() ); return cache; }
isolation = PropertiesHelper.getInteger(Environment.ISOLATION, props); if (isolation!=null) { log.info("JDBC isolation level: " + Environment.isolationLevelToString( isolation.intValue() ) ); autocommit = PropertiesHelper.getBoolean(Environment.AUTOCOMMIT, props); log.info("autocommit mode: " + autocommit);
/** * Create a new QueryResultsRegionImpl. * * @param jbcCache The JBC cache instance to use to store the query results * @param regionName The name of the region (within the JBC cache) * @param regionPrefix Any region prefix to apply * @param properties The configuration properties. */ public QueryResultsRegionImpl(Cache jbcCache, String regionName, String regionPrefix, Properties properties) { super(jbcCache, regionName, regionPrefix, null); // If JBC is using INVALIDATION, we don't want to propagate changes. // We use the Timestamps cache to manage invalidation localOnly = CacheHelper.isClusteredInvalidation(jbcCache); if (!localOnly) { // We don't want to waste effort setting an option if JBC is // already in LOCAL mode. If JBC is REPL_(A)SYNC then check // if they passed an config option to disable query replication if (CacheHelper.isClusteredReplication(jbcCache)) { if (properties.containsKey(QUERY_CACHE_LOCAL_ONLY_PROP)) { localOnly = PropertiesHelper.getBoolean(QUERY_CACHE_LOCAL_ONLY_PROP, properties, false); } else { localOnly = PropertiesHelper.getBoolean(LEGACY_QUERY_CACHE_LOCAL_ONLY_PROP, properties, false); } } } }
boolean flushBeforeCompletion = PropertiesHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties); log.info("Automatic flush during beforeCompletion(): " + enabledDisabled(flushBeforeCompletion) ); settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion); boolean autoCloseSession = PropertiesHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties); log.info("Automatic session close at end of transaction: " + enabledDisabled(autoCloseSession) ); settings.setAutoCloseSessionEnabled(autoCloseSession); int batchSize = PropertiesHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0); if ( !metaSupportsBatchUpdates ) batchSize = 0; if (batchSize>0) log.info("JDBC batch size: " + batchSize); settings.setJdbcBatchSize(batchSize); boolean jdbcBatchVersionedData = PropertiesHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false); if (batchSize>0) log.info("JDBC batch updates for versioned data: " + enabledDisabled(jdbcBatchVersionedData) ); settings.setJdbcBatchVersionedData(jdbcBatchVersionedData); settings.setBatcherFactory( createBatcherFactory(properties, batchSize) ); boolean useScrollableResultSets = PropertiesHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, metaSupportsScrollable); log.info("Scrollable result sets: " + enabledDisabled(useScrollableResultSets) ); settings.setScrollableResultSetsEnabled(useScrollableResultSets); boolean wrapResultSets = PropertiesHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false); log.debug( "Wrap result sets: " + enabledDisabled(wrapResultSets) ); settings.setWrapResultSetsEnabled(wrapResultSets); boolean useGetGeneratedKeys = PropertiesHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, metaSupportsGetGeneratedKeys); log.info("JDBC3 getGeneratedKeys(): " + enabledDisabled(useGetGeneratedKeys) ); settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys);
poolSize = PropertiesHelper.getInt(Environment.POOL_SIZE, props, 20); //default pool size 20 log.info("Using Hibernate built-in connection pool (not for production use!)"); log.info("Hibernate connection pool size: " + poolSize); autocommit = PropertiesHelper.getBoolean(Environment.AUTOCOMMIT, props); log.info("autocommit mode: " + autocommit); isolation = PropertiesHelper.getInteger(Environment.ISOLATION, props); if (isolation!=null) log.info( "JDBC isolation level: " + Environment.isolationLevelToString( isolation.intValue() ) ); log.info( "connection properties: " + PropertiesHelper.maskOut(connectionProps, "password") );
log.info( "Connection properties: " + PropertiesHelper.maskOut(connectionProps, "password") ); autocommit = PropertiesHelper.getBoolean(Environment.AUTOCOMMIT, props); log.info("autocommit mode: " + autocommit); int minPoolSize = PropertiesHelper.getInt(Environment.C3P0_MIN_SIZE, props, 1); int maxPoolSize = PropertiesHelper.getInt(Environment.C3P0_MAX_SIZE, props, 100); int maxIdleTime = PropertiesHelper.getInt(Environment.C3P0_TIMEOUT, props, 0); int maxStatements = PropertiesHelper.getInt(Environment.C3P0_MAX_STATEMENTS, props, 0); int acquireIncrement = PropertiesHelper.getInt(Environment.C3P0_ACQUIRE_INCREMENT, props, 1); int idleTestPeriod = PropertiesHelper.getInt(Environment.C3P0_IDLE_TEST_PERIOD, props, 0);
public void configure(Type type, Properties params, Dialect d) { super.configure(type, params, d); maxLo = PropertiesHelper.getInt(MAX_LO, params, Short.MAX_VALUE); lo = maxLo + 1; // so we "clock over" on the first invocation returnClass = type.getReturnedClass(); }
/** * Builds a new {@link Cache} instance, and gets it's properties from the OSCache {@link Config} * which reads the properties file (<code>oscache.properties</code>) from the classpath. * If the file cannot be found or loaded, an the defaults are used. * * @param region * @param properties * @return * @throws CacheException */ public Cache buildCache(String region, Properties properties) throws CacheException { int refreshPeriod = PropertiesHelper.getInt( StringHelper.qualify(region, OSCACHE_REFRESH_PERIOD), OSCACHE_PROPERTIES, CacheEntry.INDEFINITE_EXPIRY ); String cron = OSCACHE_PROPERTIES.getProperty( StringHelper.qualify(region, OSCACHE_CRON) ); // construct the cache final OSCache cache = new OSCache(refreshPeriod, cron, region); Integer capacity = PropertiesHelper.getInteger( StringHelper.qualify(region, OSCACHE_CAPACITY), OSCACHE_PROPERTIES ); if ( capacity!=null ) cache.setCacheCapacity( capacity.intValue() ); return cache; }
isolation = PropertiesHelper.getInteger(Environment.ISOLATION, props); if (isolation!=null) { log.info("JDBC isolation level: " + Environment.isolationLevelToString( isolation.intValue() ) ); autocommit = PropertiesHelper.getBoolean(Environment.AUTOCOMMIT, props); log.info("autocommit mode: " + autocommit);
/** * Create a new QueryResultsRegionImpl. * * @param jbcCache The JBC cache instance to use to store the query results * @param regionName The name of the region (within the JBC cache) * @param regionPrefix Any region prefix to apply * @param properties The configuration properties. */ public QueryResultsRegionImpl(Cache jbcCache, String regionName, String regionPrefix, Properties properties) { super(jbcCache, regionName, regionPrefix, null); // If JBC is using INVALIDATION, we don't want to propagate changes. // We use the Timestamps cache to manage invalidation localOnly = CacheHelper.isClusteredInvalidation(jbcCache); if (!localOnly) { // We don't want to waste effort setting an option if JBC is // already in LOCAL mode. If JBC is REPL_(A)SYNC then check // if they passed an config option to disable query replication localOnly = CacheHelper.isClusteredReplication(jbcCache) && PropertiesHelper.getBoolean(QUERY_CACHE_LOCAL_ONLY_PROP, properties, false); } }
public static String getRegionPrefix(Properties properties) { return PropertiesHelper.getString(Environment.CACHE_REGION_PREFIX, properties, null); }
public void configure(Type type, Properties params, Dialect dialect) throws MappingException { tableName = PropertiesHelper.getString(ID_TABLE, params, DEFAULT_TABLE); pkColumnName = PropertiesHelper.getString(PK_COLUMN_NAME, params, DEFAULT_PK_COLUMN); valueColumnName = PropertiesHelper.getString(VALUE_COLUMN_NAME, params, DEFAULT_VALUE_COLUMN); String schemaName = params.getProperty(SCHEMA); String catalogName = params.getProperty(CATALOG); keySize = PropertiesHelper.getInt(PK_LENGTH_NAME, params, DEFAULT_PK_LENGTH); String keyValue = PropertiesHelper.getString(PK_VALUE_NAME, params, params.getProperty(TABLE) ); maxLo = PropertiesHelper.getInt(MAX_LO, params, Short.MAX_VALUE); lo = maxLo + 1; // so we "clock over" on the first invocation returnClass = type.getReturnedClass();
public void configure(Type type, Properties params, Dialect d) { super.configure(type, params, d); maxLo = PropertiesHelper.getInt(MAX_LO, params, Short.MAX_VALUE); lo = maxLo + 1; // so we "clock over" on the first invocation returnClass = type.getReturnedClass(); }