Search in sources :

Example 1 with LegacyHiLoAlgorithmOptimizer

use of org.hibernate.id.enhanced.LegacyHiLoAlgorithmOptimizer in project hibernate-orm by hibernate.

the class MultipleHiLoPerTableGenerator method configure.

@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);
    }
}
Also used : LegacyHiLoAlgorithmOptimizer(org.hibernate.id.enhanced.LegacyHiLoAlgorithmOptimizer) JdbcEnvironment(org.hibernate.engine.jdbc.env.spi.JdbcEnvironment)

Example 2 with LegacyHiLoAlgorithmOptimizer

use of org.hibernate.id.enhanced.LegacyHiLoAlgorithmOptimizer in project hibernate-orm by hibernate.

the class SequenceHiLoGenerator method configure.

@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);
    }
}
Also used : LegacyHiLoAlgorithmOptimizer(org.hibernate.id.enhanced.LegacyHiLoAlgorithmOptimizer)

Aggregations

LegacyHiLoAlgorithmOptimizer (org.hibernate.id.enhanced.LegacyHiLoAlgorithmOptimizer)2 JdbcEnvironment (org.hibernate.engine.jdbc.env.spi.JdbcEnvironment)1