idGen.addParam( TableHiLoGenerator.MAX_LO, String.valueOf( tabGen.allocationSize() - 1 ) );
}
log.trace( "Add table generator with name: {}", idGen.getName() );
}
else if ( ann instanceof SequenceGenerator ) {
SequenceGenerator seqGen = (SequenceGenerator) ann;
idGen.setName( seqGen.name() );
if ( useNewGeneratorMappings ) {
idGen.setIdentifierGeneratorStrategy( SequenceStyleGenerator.class.getName() );
if ( !BinderHelper.isDefault( seqGen.catalog() ) ) {
idGen.addParam( SequenceStyleGenerator.CATALOG, seqGen.catalog() );
}
if ( !BinderHelper.isDefault( seqGen.schema() ) ) {
idGen.addParam( SequenceStyleGenerator.SCHEMA, seqGen.schema() );
}
if ( !BinderHelper.isDefault( seqGen.sequenceName() ) ) {
idGen.addParam( SequenceStyleGenerator.SEQUENCE_PARAM, seqGen.sequenceName() );
}
idGen.addParam( SequenceStyleGenerator.INCREMENT_PARAM, String.valueOf( seqGen.allocationSize() ) );
idGen.addParam( SequenceStyleGenerator.INITIAL_PARAM, String.valueOf( seqGen.initialValue() ) );
}
else {
idGen.setIdentifierGeneratorStrategy( "seqhilo" );
if ( !BinderHelper.isDefault( seqGen.sequenceName() ) ) {
idGen.addParam( org.hibernate.id.SequenceGenerator.SEQUENCE, seqGen.sequenceName() );
}
//FIXME: work on initialValue() through SequenceGenerator.PARAMETERS
// steve : or just use o.h.id.enhanced.SequenceStyleGenerator
if ( seqGen.initialValue() != 1 ) {
log.warn(
"Hibernate does not support SequenceGenerator.initialValue() unless '{}' set",
AnnotationConfiguration.USE_NEW_ID_GENERATOR_MAPPINGS
);
}
idGen.addParam( SequenceHiLoGenerator.MAX_LO, String.valueOf( seqGen.allocationSize() - 1 ) );
log.trace( "Add sequence generator with name: {}", idGen.getName() );
}
}
else if ( ann instanceof GenericGenerator ) {
GenericGenerator genGen = (GenericGenerator) ann;