use of org.hibernate.boot.registry.selector.spi.StrategySelector 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());
}
}
}
use of org.hibernate.boot.registry.selector.spi.StrategySelector in project hibernate-orm by hibernate.
the class SchemaExport method buildMetadata.
private static MetadataImplementor buildMetadata(CommandLineArgs parsedArgs, StandardServiceRegistry serviceRegistry) throws Exception {
final MetadataSources metadataSources = new MetadataSources(serviceRegistry);
for (String filename : parsedArgs.hbmXmlFiles) {
metadataSources.addFile(filename);
}
for (String filename : parsedArgs.jarFiles) {
metadataSources.addJar(new File(filename));
}
final MetadataBuilder metadataBuilder = metadataSources.getMetadataBuilder();
final StrategySelector strategySelector = serviceRegistry.getService(StrategySelector.class);
if (parsedArgs.implicitNamingStrategyImplName != null) {
metadataBuilder.applyImplicitNamingStrategy(strategySelector.resolveStrategy(ImplicitNamingStrategy.class, parsedArgs.implicitNamingStrategyImplName));
}
if (parsedArgs.physicalNamingStrategyImplName != null) {
metadataBuilder.applyPhysicalNamingStrategy(strategySelector.resolveStrategy(PhysicalNamingStrategy.class, parsedArgs.physicalNamingStrategyImplName));
}
return (MetadataImplementor) metadataBuilder.build();
}
use of org.hibernate.boot.registry.selector.spi.StrategySelector in project hibernate-orm by hibernate.
the class SchemaValidator method buildMetadata.
private static MetadataImplementor buildMetadata(CommandLineArgs parsedArgs, StandardServiceRegistry serviceRegistry) throws Exception {
final MetadataSources metadataSources = new MetadataSources(serviceRegistry);
for (String filename : parsedArgs.hbmXmlFiles) {
metadataSources.addFile(filename);
}
for (String filename : parsedArgs.jarFiles) {
metadataSources.addJar(new File(filename));
}
final MetadataBuilder metadataBuilder = metadataSources.getMetadataBuilder();
final StrategySelector strategySelector = serviceRegistry.getService(StrategySelector.class);
if (parsedArgs.implicitNamingStrategy != null) {
metadataBuilder.applyImplicitNamingStrategy(strategySelector.resolveStrategy(ImplicitNamingStrategy.class, parsedArgs.implicitNamingStrategy));
}
if (parsedArgs.physicalNamingStrategy != null) {
metadataBuilder.applyPhysicalNamingStrategy(strategySelector.resolveStrategy(PhysicalNamingStrategy.class, parsedArgs.physicalNamingStrategy));
}
return (MetadataImplementor) metadataBuilder.build();
}
use of org.hibernate.boot.registry.selector.spi.StrategySelector in project hibernate-orm by hibernate.
the class OracleSDOSupport method mkSdoGeometryTypeDescriptor.
private SDOGeometryTypeDescriptor mkSdoGeometryTypeDescriptor(ServiceRegistry serviceRegistry) {
final ConfigurationService cfgService = serviceRegistry.getService(ConfigurationService.class);
final StrategySelector strategySelector = serviceRegistry.getService(StrategySelector.class);
final ConnectionFinder connectionFinder = strategySelector.resolveStrategy(ConnectionFinder.class, cfgService.getSetting(HibernateSpatialConfigurationSettings.CONNECTION_FINDER, String.class, "org.geolatte.geom.codec.db.oracle.DefaultConnectionFinder"));
log.connectionFinder(connectionFinder.getClass().getCanonicalName());
return new SDOGeometryTypeDescriptor(new OracleJDBCTypeFactory(connectionFinder));
}
Aggregations