use of org.hibernate.jpa.boot.spi.TypeContributorList in project hibernate-orm by hibernate.
the class EntityManagerFactoryBuilderImpl method populate.
protected void populate(MetadataBuilder metamodelBuilder, MergedSettings mergedSettings, StandardServiceRegistry ssr, List<AttributeConverterDefinition> attributeConverterDefinitions) {
if (persistenceUnit.getTempClassLoader() != null) {
metamodelBuilder.applyTempClassLoader(persistenceUnit.getTempClassLoader());
}
metamodelBuilder.applyScanEnvironment(new StandardJpaScanEnvironmentImpl(persistenceUnit));
metamodelBuilder.applyScanOptions(new StandardScanOptions((String) configurationValues.get(org.hibernate.cfg.AvailableSettings.SCANNER_DISCOVERY), persistenceUnit.isExcludeUnlistedClasses()));
if (mergedSettings.cacheRegionDefinitions != null) {
for (CacheRegionDefinition localCacheRegionDefinition : mergedSettings.cacheRegionDefinitions) {
metamodelBuilder.applyCacheRegionDefinition(localCacheRegionDefinition);
}
}
final TypeContributorList typeContributorList = (TypeContributorList) configurationValues.remove(TYPE_CONTRIBUTORS);
if (typeContributorList != null) {
for (TypeContributor typeContributor : typeContributorList.getTypeContributors()) {
metamodelBuilder.applyTypes(typeContributor);
}
}
if (attributeConverterDefinitions != null) {
for (AttributeConverterDefinition attributeConverterDefinition : attributeConverterDefinitions) {
metamodelBuilder.applyAttributeConverter(attributeConverterDefinition);
}
}
}
use of org.hibernate.jpa.boot.spi.TypeContributorList in project hibernate-orm by hibernate.
the class OsgiPersistenceProvider method generateSettings.
@SuppressWarnings("unchecked")
private Map generateSettings(Map properties) {
final Map settings = new HashMap();
if (properties != null) {
settings.putAll(properties);
}
settings.put(AvailableSettings.JTA_PLATFORM, osgiJtaPlatform);
final Integrator[] integrators = osgiServiceUtil.getServiceImpls(Integrator.class);
final IntegratorProvider integratorProvider = new IntegratorProvider() {
@Override
public List<Integrator> getIntegrators() {
return Arrays.asList(integrators);
}
};
settings.put(EntityManagerFactoryBuilderImpl.INTEGRATOR_PROVIDER, integratorProvider);
final StrategyRegistrationProvider[] strategyRegistrationProviders = osgiServiceUtil.getServiceImpls(StrategyRegistrationProvider.class);
final StrategyRegistrationProviderList strategyRegistrationProviderList = new StrategyRegistrationProviderList() {
@Override
public List<StrategyRegistrationProvider> getStrategyRegistrationProviders() {
return Arrays.asList(strategyRegistrationProviders);
}
};
settings.put(EntityManagerFactoryBuilderImpl.STRATEGY_REGISTRATION_PROVIDERS, strategyRegistrationProviderList);
final TypeContributor[] typeContributors = osgiServiceUtil.getServiceImpls(TypeContributor.class);
final TypeContributorList typeContributorList = new TypeContributorList() {
@Override
public List<TypeContributor> getTypeContributors() {
return Arrays.asList(typeContributors);
}
};
settings.put(EntityManagerFactoryBuilderImpl.TYPE_CONTRIBUTORS, typeContributorList);
return settings;
}
Aggregations