use of org.hibernate.jpa.spi.IdentifierGeneratorStrategyProvider in project hibernate-orm by hibernate.
the class EntityManagerFactoryBuilderImpl method configure.
private void configure(StandardServiceRegistry ssr, MergedSettings mergedSettings) {
final StrategySelector strategySelector = ssr.getService(StrategySelector.class);
// apply id generators
final Object idGeneratorStrategyProviderSetting = configurationValues.remove(AvailableSettings.IDENTIFIER_GENERATOR_STRATEGY_PROVIDER);
if (idGeneratorStrategyProviderSetting != null) {
final IdentifierGeneratorStrategyProvider idGeneratorStrategyProvider = strategySelector.resolveStrategy(IdentifierGeneratorStrategyProvider.class, idGeneratorStrategyProviderSetting);
final MutableIdentifierGeneratorFactory identifierGeneratorFactory = ssr.getService(MutableIdentifierGeneratorFactory.class);
if (identifierGeneratorFactory == null) {
throw persistenceException("Application requested custom identifier generator strategies, " + "but the MutableIdentifierGeneratorFactory could not be found");
}
for (Map.Entry<String, Class<?>> entry : idGeneratorStrategyProvider.getStrategies().entrySet()) {
identifierGeneratorFactory.register(entry.getKey(), entry.getValue());
}
}
}
Aggregations