use of org.hibernate.id.Configurable in project hibernate-orm by hibernate.
the class DefaultIdentifierGeneratorFactory method createIdentifierGenerator.
@Override
public IdentifierGenerator createIdentifierGenerator(String strategy, Type type, Properties config) {
try {
Class clazz = getIdentifierGeneratorClass(strategy);
IdentifierGenerator identifierGenerator = (IdentifierGenerator) clazz.newInstance();
if (identifierGenerator instanceof Configurable) {
((Configurable) identifierGenerator).configure(type, config, serviceRegistry);
}
return identifierGenerator;
} catch (Exception e) {
final String entityName = config.getProperty(IdentifierGenerator.ENTITY_NAME);
throw new MappingException(String.format("Could not instantiate id generator [entity-name=%s]", entityName), e);
}
}
Aggregations