Java Code Examples for org.hibernate.internal.util.config.ConfigurationHelper#getInt()
The following examples show how to use
org.hibernate.internal.util.config.ConfigurationHelper#getInt() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DriverManagerConnectionProviderImpl.java From lams with GNU General Public License v2.0 | 6 votes |
private PooledConnections buildPool(Map configurationValues) { final boolean autoCommit = ConfigurationHelper.getBoolean( AvailableSettings.AUTOCOMMIT, configurationValues, false ); final int minSize = ConfigurationHelper.getInt( MIN_SIZE, configurationValues, 1 ); final int maxSize = ConfigurationHelper.getInt( AvailableSettings.POOL_SIZE, configurationValues, 20 ); final int initialSize = ConfigurationHelper.getInt( INITIAL_SIZE, configurationValues, minSize ); ConnectionCreator connectionCreator = buildCreator( configurationValues ); PooledConnections.Builder pooledConnectionBuilder = new PooledConnections.Builder( connectionCreator, autoCommit ); pooledConnectionBuilder.initialSize( initialSize ); pooledConnectionBuilder.minSize( minSize ); pooledConnectionBuilder.maxSize( maxSize ); return pooledConnectionBuilder.build(); }
Example 2
Source File: BatchBuilderInitiator.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public BatchBuilder initiateService(Map configurationValues, ServiceRegistryImplementor registry) { final Object builder = configurationValues.get( BUILDER ); if ( builder == null ) { return new BatchBuilderImpl( ConfigurationHelper.getInt( Environment.STATEMENT_BATCH_SIZE, configurationValues, 1 ) ); } if ( BatchBuilder.class.isInstance( builder ) ) { return (BatchBuilder) builder; } final String builderClassName = builder.toString(); try { return (BatchBuilder) registry.getService( ClassLoaderService.class ).classForName( builderClassName ).newInstance(); } catch (Exception e) { throw new ServiceException( "Could not build explicit BatchBuilder [" + builderClassName + "]", e ); } }
Example 3
Source File: MultipleHiLoPerTableGenerator.java From lams with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings({"StatementWithEmptyBody", "deprecation"}) public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException { returnClass = type.getReturnedClass(); final JdbcEnvironment jdbcEnvironment = serviceRegistry.getService( JdbcEnvironment.class ); qualifiedTableName = determineGeneratorTableName( params, jdbcEnvironment ); segmentColumnName = determineSegmentColumnName( params, jdbcEnvironment ); keySize = ConfigurationHelper.getInt( PK_LENGTH_NAME, params, DEFAULT_PK_LENGTH ); segmentName = ConfigurationHelper.getString( PK_VALUE_NAME, params, params.getProperty( TABLE ) ); valueColumnName = determineValueColumnName( params, jdbcEnvironment ); //hilo config maxLo = ConfigurationHelper.getInt( MAX_LO, params, Short.MAX_VALUE ); if ( maxLo >= 1 ) { hiloOptimizer = new LegacyHiLoAlgorithmOptimizer( returnClass, maxLo ); } }
Example 4
Source File: QueryPlanCache.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Constructs the QueryPlanCache to be used by the given SessionFactory * * @param factory The SessionFactory */ @SuppressWarnings("deprecation") public QueryPlanCache(final SessionFactoryImplementor factory) { this.factory = factory; Integer maxParameterMetadataCount = ConfigurationHelper.getInteger( Environment.QUERY_PLAN_CACHE_PARAMETER_METADATA_MAX_SIZE, factory.getProperties() ); if ( maxParameterMetadataCount == null ) { maxParameterMetadataCount = ConfigurationHelper.getInt( Environment.QUERY_PLAN_CACHE_MAX_STRONG_REFERENCES, factory.getProperties(), DEFAULT_PARAMETER_METADATA_MAX_COUNT ); } Integer maxQueryPlanCount = ConfigurationHelper.getInteger( Environment.QUERY_PLAN_CACHE_MAX_SIZE, factory.getProperties() ); if ( maxQueryPlanCount == null ) { maxQueryPlanCount = ConfigurationHelper.getInt( Environment.QUERY_PLAN_CACHE_MAX_SOFT_REFERENCES, factory.getProperties(), DEFAULT_QUERY_PLAN_MAX_COUNT ); } queryPlanCache = new BoundedConcurrentHashMap( maxQueryPlanCount, 20, BoundedConcurrentHashMap.Eviction.LIRS ); parameterMetadataCache = new BoundedConcurrentHashMap<>( maxParameterMetadataCount, 20, BoundedConcurrentHashMap.Eviction.LIRS ); nativeQueryInterpreter = factory.getServiceRegistry().getService( NativeQueryInterpreter.class ); }
Example 5
Source File: TableGenerator.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException { storeLastUsedValue = serviceRegistry.getService( ConfigurationService.class ) .getSetting( AvailableSettings.TABLE_GENERATOR_STORE_LAST_USED, StandardConverters.BOOLEAN, true ); identifierType = type; final JdbcEnvironment jdbcEnvironment = serviceRegistry.getService( JdbcEnvironment.class ); qualifiedTableName = determineGeneratorTableName( params, jdbcEnvironment, serviceRegistry ); segmentColumnName = determineSegmentColumnName( params, jdbcEnvironment ); valueColumnName = determineValueColumnName( params, jdbcEnvironment ); segmentValue = determineSegmentValue( params ); segmentValueLength = determineSegmentColumnSize( params ); initialValue = determineInitialValue( params ); incrementSize = determineIncrementSize( params ); final String optimizationStrategy = ConfigurationHelper.getString( OPT_PARAM, params, OptimizerFactory.determineImplicitOptimizerName( incrementSize, params ) ); int optimizerInitialValue = ConfigurationHelper.getInt( INITIAL_PARAM, params, -1 ); optimizer = OptimizerFactory.buildOptimizer( optimizationStrategy, identifierType.getReturnedClass(), incrementSize, optimizerInitialValue ); }
Example 6
Source File: SequenceHiLoGenerator.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException { super.configure( type, params, serviceRegistry ); maxLo = ConfigurationHelper.getInt( MAX_LO, params, 9 ); if ( maxLo >= 1 ) { hiloOptimizer = new LegacyHiLoAlgorithmOptimizer( getIdentifierType().getReturnedClass(), maxLo ); } }
Example 7
Source File: TableReactiveIdentifierGenerator.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 4 votes |
protected int determineInitialValueForTable(Properties params) { return ConfigurationHelper.getInt( TableGenerator.INITIAL_PARAM, params, TableGenerator.DEFAULT_INITIAL_VALUE ); }
Example 8
Source File: TableReactiveIdentifierGenerator.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 4 votes |
protected int determineInitialValueForSequenceEmulation(Properties params) { return ConfigurationHelper.getInt( SequenceStyleGenerator.INITIAL_PARAM, params, SequenceStyleGenerator.DEFAULT_INITIAL_VALUE ); }
Example 9
Source File: BatchBuilderImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public void configure(Map configurationValues) { jdbcBatchSize = ConfigurationHelper.getInt( Environment.STATEMENT_BATCH_SIZE, configurationValues, jdbcBatchSize ); }
Example 10
Source File: TableGenerator.java From lams with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("WeakerAccess") protected int determineInitialValue(Properties params) { return ConfigurationHelper.getInt( INITIAL_PARAM, params, DEFAULT_INITIAL_VALUE ); }
Example 11
Source File: TableGenerator.java From lams with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("WeakerAccess") protected int determineIncrementSize(Properties params) { return ConfigurationHelper.getInt( INCREMENT_PARAM, params, DEFAULT_INCREMENT_SIZE ); }
Example 12
Source File: SharedSessionContractImplementor.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Get the currently configured JDBC batch size either at the Session-level or SessionFactory-level. * * If the Session-level JDBC batch size was not configured, return the SessionFactory-level one. * * @return Session-level or or SessionFactory-level JDBC batch size. * * @since 5.2 * * @see org.hibernate.boot.spi.SessionFactoryOptions#getJdbcBatchSize * @see org.hibernate.boot.SessionFactoryBuilder#applyJdbcBatchSize */ default Integer getConfiguredJdbcBatchSize() { final Integer sessionJdbcBatchSize = getJdbcBatchSize(); return sessionJdbcBatchSize == null ? ConfigurationHelper.getInt( Environment.STATEMENT_BATCH_SIZE, getFactory().getProperties(), 1 ) : sessionJdbcBatchSize; }
Example 13
Source File: SequenceStyleGenerator.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Determine the initial sequence value to use. This value is used when * initializing the {@link #getDatabaseStructure() database structure} * (i.e. sequence/table). * <p/> * Called during {@link #configure configuration}. * * @param params The params supplied in the generator config (plus some standard useful extras). * @return The initial value */ @SuppressWarnings({"WeakerAccess"}) protected int determineInitialValue(Properties params) { return ConfigurationHelper.getInt( INITIAL_PARAM, params, DEFAULT_INITIAL_VALUE ); }
Example 14
Source File: SequenceStyleGenerator.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Determine the increment size to be applied. The exact implications of * this value depends on the {@link #getOptimizer() optimizer} being used. * <p/> * Called during {@link #configure configuration}. * * @param params The params supplied in the generator config (plus some standard useful extras). * @return The increment size */ @SuppressWarnings("WeakerAccess") protected int determineIncrementSize(Properties params) { return ConfigurationHelper.getInt( INCREMENT_PARAM, params, DEFAULT_INCREMENT_SIZE ); }
Example 15
Source File: TableGenerator.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Determine the size of the {@link #getSegmentColumnName segment column} * <p/> * Called during {@link #configure configuration}. * * @see #getSegmentValueLength() * @param params The params supplied in the generator config (plus some standard useful extras). * @return The size of the segment column */ @SuppressWarnings("WeakerAccess") protected int determineSegmentColumnSize(Properties params) { return ConfigurationHelper.getInt( SEGMENT_LENGTH_PARAM, params, DEF_SEGMENT_LENGTH ); }