HHH-17328 Add discriminator to entity graph with inheritance subtypes
This commit is contained in:
parent
aec7887a66
commit
da070f8f5a
|
@ -8183,16 +8183,22 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
final TableGroup actualTableGroup = joinedTableGroup instanceof PluralTableGroup ?
|
||||
( (PluralTableGroup) joinedTableGroup ).getElementTableGroup() :
|
||||
joinedTableGroup;
|
||||
final MappingType entityMappingType = actualTableGroup == null
|
||||
final MappingType mappingType = actualTableGroup == null
|
||||
? null
|
||||
: actualTableGroup.getModelPart().getPartMappingType();
|
||||
if ( entityMappingType instanceof EntityMappingType ) {
|
||||
if ( mappingType instanceof EntityMappingType ) {
|
||||
final EntityMappingType entityMappingType = (EntityMappingType) mappingType;
|
||||
registerEntityNameUsage(
|
||||
actualTableGroup,
|
||||
EntityNameUse.PROJECTION,
|
||||
( (EntityMappingType) entityMappingType ).getEntityName(),
|
||||
entityMappingType.getEntityName(),
|
||||
true
|
||||
);
|
||||
if ( entityMappingType.getSuperMappingType() != null ) {
|
||||
// A joined table group was created by an enabled entity graph or fetch profile,
|
||||
// and it's of an inheritance subtype, so we should apply the discriminator
|
||||
entityMappingType.applyDiscriminator( null, null, actualTableGroup, this );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( fetchable instanceof PluralAttributeMapping ) {
|
||||
|
|
Loading…
Reference in New Issue