org.hibernate.jpa.spi.IdentifierGeneratorStrategyProvider Java Examples
The following examples show how to use
org.hibernate.jpa.spi.IdentifierGeneratorStrategyProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FastBootMetadataBuilder.java From quarkus with Apache License 2.0 | 6 votes |
private void registerIdentifierGenerators(StandardServiceRegistry ssr) { final StrategySelector strategySelector = ssr.getService(StrategySelector.class); // apply id generators final Object idGeneratorStrategyProviderSetting = buildTimeSettings .get(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()); } } }
Example #2
Source File: EntityManagerFactoryBuilderImpl.java From lams with GNU General Public License v2.0 | 6 votes |
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() ); } } }