HHH-10837 - with jpaMetaModelPopulationSetting.DISABLED the MetadataContext is not created

This commit is contained in:
Andrea Boriero 2016-06-21 11:23:58 +02:00
parent 248d9cca14
commit 1558eb73a6

View File

@ -205,17 +205,18 @@ public MetadataImplementor getMetadata() {
} }
collectionPersisterMap.values().forEach( CollectionPersister::postInstantiate ); collectionPersisterMap.values().forEach( CollectionPersister::postInstantiate );
if ( jpaMetaModelPopulationSetting != JpaMetaModelPopulationSetting.DISABLED ) {
MetadataContext context = new MetadataContext( MetadataContext context = new MetadataContext(
sessionFactory, sessionFactory,
mappingMetadata.getMappedSuperclassMappingsCopy(), mappingMetadata.getMappedSuperclassMappingsCopy(),
jpaMetaModelPopulationSetting jpaMetaModelPopulationSetting
); );
if ( jpaMetaModelPopulationSetting != JpaMetaModelPopulationSetting.DISABLED ) {
for ( PersistentClass entityBinding : mappingMetadata.getEntityBindings() ) { for ( PersistentClass entityBinding : mappingMetadata.getEntityBindings() ) {
locateOrBuildEntityType( entityBinding, context ); locateOrBuildEntityType( entityBinding, context );
} }
handleUnusedMappedSuperclasses( context ); handleUnusedMappedSuperclasses( context );
}
context.wrapUp(); context.wrapUp();
this.jpaEntityTypeMap.putAll( context.getEntityTypeMap() ); this.jpaEntityTypeMap.putAll( context.getEntityTypeMap() );
@ -224,6 +225,7 @@ public MetadataImplementor getMetadata() {
this.jpaEntityTypesByEntityName.putAll( context.getEntityTypesByEntityName() ); this.jpaEntityTypesByEntityName.putAll( context.getEntityTypesByEntityName() );
applyNamedEntityGraphs( mappingMetadata.getNamedEntityGraphs().values() ); applyNamedEntityGraphs( mappingMetadata.getNamedEntityGraphs().values() );
}
} }