Skip to content

Commit 161e95d

Browse files
committed
HHH-18482 - Provide access to a mutable ClassDetailsRegistry from the Integrator
HHH-19274 - Deprecate MetadataBuilder#applyIndexView and friends
1 parent 671d24e commit 161e95d

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

hibernate-core/src/main/java/org/hibernate/boot/internal/BootstrapContextImpl.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ public BootstrapContextImpl(
9292
classLoaderService = serviceRegistry.requireService( ClassLoaderService.class );
9393
classLoaderAccess = new ClassLoaderAccessImpl( classLoaderService );
9494

95-
9695
final StrategySelector strategySelector = serviceRegistry.requireService( StrategySelector.class );
9796
final ConfigurationService configService = serviceRegistry.requireService( ConfigurationService.class );
9897

@@ -118,7 +117,7 @@ public BootstrapContextImpl(
118117
managedBeanRegistry = serviceRegistry.requireService( ManagedBeanRegistry.class );
119118
configurationService = serviceRegistry.requireService( ConfigurationService.class );
120119

121-
modelsContext = createModelBuildingContext( classLoaderService );
120+
modelsContext = createModelBuildingContext( classLoaderService, configService );
122121
}
123122

124123
@Override
@@ -355,12 +354,19 @@ public void addCacheRegionDefinition(CacheRegionDefinition cacheRegionDefinition
355354
cacheRegionDefinitions.add( cacheRegionDefinition );
356355
}
357356

358-
public static SourceModelBuildingContext createModelBuildingContext(ClassLoaderService classLoaderService) {
357+
public static SourceModelBuildingContext createModelBuildingContext(
358+
ClassLoaderService classLoaderService,
359+
ConfigurationService configService) {
359360
final ClassLoaderServiceLoading classLoading = new ClassLoaderServiceLoading( classLoaderService );
360361

361362
final ModelsConfiguration modelsConfiguration = new ModelsConfiguration();
362363
modelsConfiguration.setClassLoading( classLoading );
363364
modelsConfiguration.setRegistryPrimer( ModelsHelper::preFillRegistries );
365+
configService.getSettings().forEach( (key, value) -> {
366+
if ( key.startsWith( "hibernate.models." ) ) {
367+
modelsConfiguration.configValue( key, value );
368+
}
369+
} );
364370
return modelsConfiguration.bootstrap();
365371
}
366372
}

hibernate-core/src/test/java/org/hibernate/orm/test/boot/models/BootstrapContextTesting.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
import java.util.HashMap;
4444
import java.util.Map;
4545

46+
import static org.hibernate.boot.internal.BootstrapContextImpl.createModelBuildingContext;
47+
4648
/**
4749
* BootstrapContext impl to be able to inject a Jandex index
4850
*
@@ -117,7 +119,7 @@ public BootstrapContextTesting(
117119
this.managedBeanRegistry = serviceRegistry.requireService( ManagedBeanRegistry.class );
118120
this.configurationService = serviceRegistry.requireService( ConfigurationService.class );
119121

120-
this.modelsContext = BootstrapContextImpl.createModelBuildingContext( classLoaderService );
122+
this.modelsContext = createModelBuildingContext( classLoaderService, configService );
121123
}
122124

123125
@Override

0 commit comments

Comments
 (0)