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
1 changed files with 15 additions and 13 deletions

View File

@ -205,25 +205,27 @@ public class MetamodelImpl implements MetamodelImplementor, Serializable {
}
collectionPersisterMap.values().forEach( CollectionPersister::postInstantiate );
MetadataContext context = new MetadataContext(
sessionFactory,
mappingMetadata.getMappedSuperclassMappingsCopy(),
jpaMetaModelPopulationSetting
);
if ( jpaMetaModelPopulationSetting != JpaMetaModelPopulationSetting.DISABLED ) {
MetadataContext context = new MetadataContext(
sessionFactory,
mappingMetadata.getMappedSuperclassMappingsCopy(),
jpaMetaModelPopulationSetting
);
for ( PersistentClass entityBinding : mappingMetadata.getEntityBindings() ) {
locateOrBuildEntityType( entityBinding, context );
}
handleUnusedMappedSuperclasses( context );
context.wrapUp();
this.jpaEntityTypeMap.putAll( context.getEntityTypeMap() );
this.jpaEmbeddableTypeMap.putAll( context.getEmbeddableTypeMap() );
this.jpaMappedSuperclassTypeMap.putAll( context.getMappedSuperclassTypeMap() );
this.jpaEntityTypesByEntityName.putAll( context.getEntityTypesByEntityName() );
applyNamedEntityGraphs( mappingMetadata.getNamedEntityGraphs().values() );
}
context.wrapUp();
this.jpaEntityTypeMap.putAll( context.getEntityTypeMap() );
this.jpaEmbeddableTypeMap.putAll( context.getEmbeddableTypeMap() );
this.jpaMappedSuperclassTypeMap.putAll( context.getMappedSuperclassTypeMap() );
this.jpaEntityTypesByEntityName.putAll( context.getEntityTypesByEntityName() );
applyNamedEntityGraphs( mappingMetadata.getNamedEntityGraphs().values() );
}