// YUCK! but cannot think of a clean way to do this given the string-config based scheme
params.put( PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER, mappings.getObjectNameNormalizer() );
if ( !isEmptyAnnotationValue( generatorName ) ) {
//we have a named generator
IdGenerator gen = mappings.getGenerator( generatorName, localGenerators );
if ( gen == null ) {
throw new AnnotationException( "Unknown Id.generator: " + generatorName );
}
//This is quite vague in the spec but a generator could override the generate choice
String identifierGeneratorStrategy = gen.getIdentifierGeneratorStrategy();
//yuk! this is a hack not to override 'AUTO' even if generator is set
final boolean avoidOverriding =
identifierGeneratorStrategy.equals( "identity" )
|| identifierGeneratorStrategy.equals( "seqhilo" )
|| identifierGeneratorStrategy.equals( MultipleHiLoPerTableGenerator.class.getName() );
if ( generatorType == null || !avoidOverriding ) {
id.setIdentifierGeneratorStrategy( identifierGeneratorStrategy );
}
//checkIfMatchingGenerator(gen, generatorType, generatorName);
Iterator genParams = gen.getParams().entrySet().iterator();
while ( genParams.hasNext() ) {
Map.Entry elt = (Map.Entry) genParams.next();
params.setProperty( (String) elt.getKey(), (String) elt.getValue() );
}
}