Search in sources :

Example 1 with TypeContributorList

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);
        }
    }
}
Also used : AttributeConverterDefinition(org.hibernate.cfg.AttributeConverterDefinition) CacheRegionDefinition(org.hibernate.boot.CacheRegionDefinition) TypeContributorList(org.hibernate.jpa.boot.spi.TypeContributorList) StandardScanOptions(org.hibernate.boot.archive.scan.internal.StandardScanOptions) TypeContributor(org.hibernate.boot.model.TypeContributor)

Example 2 with TypeContributorList

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;
}
Also used : StrategyRegistrationProvider(org.hibernate.boot.registry.selector.StrategyRegistrationProvider) HashMap(java.util.HashMap) Integrator(org.hibernate.integrator.spi.Integrator) TypeContributorList(org.hibernate.jpa.boot.spi.TypeContributorList) HashMap(java.util.HashMap) Map(java.util.Map) IntegratorProvider(org.hibernate.jpa.boot.spi.IntegratorProvider) StrategyRegistrationProviderList(org.hibernate.jpa.boot.spi.StrategyRegistrationProviderList) TypeContributor(org.hibernate.boot.model.TypeContributor)

Aggregations

TypeContributor (org.hibernate.boot.model.TypeContributor)2 TypeContributorList (org.hibernate.jpa.boot.spi.TypeContributorList)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 CacheRegionDefinition (org.hibernate.boot.CacheRegionDefinition)1 StandardScanOptions (org.hibernate.boot.archive.scan.internal.StandardScanOptions)1 StrategyRegistrationProvider (org.hibernate.boot.registry.selector.StrategyRegistrationProvider)1 AttributeConverterDefinition (org.hibernate.cfg.AttributeConverterDefinition)1 Integrator (org.hibernate.integrator.spi.Integrator)1 IntegratorProvider (org.hibernate.jpa.boot.spi.IntegratorProvider)1 StrategyRegistrationProviderList (org.hibernate.jpa.boot.spi.StrategyRegistrationProviderList)1