HHH-12871 - Fix metamodel to properly exclude dynamic-map based types when using ignoreUnsupported.

This commit is contained in:
Chris Cranford 2018-08-07 09:29:00 -04:00
parent 6a594712db
commit b9e0449602
2 changed files with 9 additions and 2 deletions

View File

@ -116,16 +116,23 @@ class MetadataContext {
} }
/*package*/ void registerEntityType(PersistentClass persistentClass, EntityTypeImpl<?> entityType) { /*package*/ void registerEntityType(PersistentClass persistentClass, EntityTypeImpl<?> entityType) {
if ( ignoreUnsupported && entityType.getBindableJavaType() == null ) {
return;
}
if ( entityType.getBindableJavaType() != null ) { if ( entityType.getBindableJavaType() != null ) {
entityTypes.put( entityType.getBindableJavaType(), entityType ); entityTypes.put( entityType.getBindableJavaType(), entityType );
} }
entityTypesByEntityName.put( persistentClass.getEntityName(), entityType ); entityTypesByEntityName.put( persistentClass.getEntityName(), entityType );
entityTypesByPersistentClass.put( persistentClass, entityType ); entityTypesByPersistentClass.put( persistentClass, entityType );
orderedMappings.add( persistentClass ); orderedMappings.add( persistentClass );
} }
/*package*/ void registerEmbeddedableType(EmbeddableTypeImpl<?> embeddableType) { /*package*/ void registerEmbeddedableType(EmbeddableTypeImpl<?> embeddableType) {
embeddables.add( embeddableType ); if ( !( ignoreUnsupported && embeddableType.getParent().getJavaType() == null ) ) {
embeddables.add( embeddableType );
}
} }
/*package*/ void registerMappedSuperclassType( /*package*/ void registerMappedSuperclassType(

View File

@ -570,7 +570,7 @@ public class MetamodelImpl implements MetamodelImplementor, Serializable {
jpaEntityTypeMap.size() + jpaMappedSuperclassTypeMap.size() + jpaEmbeddableTypes.size() jpaEntityTypeMap.size() + jpaMappedSuperclassTypeMap.size() + jpaEmbeddableTypes.size()
); );
final Set<ManagedType<?>> managedTypes = new HashSet<ManagedType<?>>( setSize ); final Set<ManagedType<?>> managedTypes = new HashSet<ManagedType<?>>( setSize );
managedTypes.addAll( jpaEntityTypeMap.values() ); managedTypes.addAll( jpaEntityTypesByEntityName.values() );
managedTypes.addAll( jpaMappedSuperclassTypeMap.values() ); managedTypes.addAll( jpaMappedSuperclassTypeMap.values() );
managedTypes.addAll( jpaEmbeddableTypes ); managedTypes.addAll( jpaEmbeddableTypes );
return managedTypes; return managedTypes;