HHH-17096 Always initialize table group for subtype treated joins
This commit is contained in:
parent
c6c9671385
commit
a4cbe2f95a
|
@ -3084,8 +3084,11 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
(s, existingUse) -> finalEntityNameUse.stronger( existingUse )
|
||||
);
|
||||
|
||||
// Resolve the table reference for all types which we register an entity name use for
|
||||
if ( actualTableGroup.isInitialized() ) {
|
||||
// Resolve the table reference for all types which we register an entity name use for.
|
||||
// Also, force table group initialization for treats when needed to ensure correct cardinality
|
||||
final EntityNameUse.UseKind useKind = finalEntityNameUse.getKind();
|
||||
if ( actualTableGroup.isInitialized() || ( useKind == EntityNameUse.UseKind.TREAT && actualTableGroup.canUseInnerJoins()
|
||||
&& !( (EntityMappingType) actualTableGroup.getModelPart().getPartMappingType() ).isTypeOrSuperType( persister ) ) ) {
|
||||
actualTableGroup.resolveTableReference( null, persister.getTableName() );
|
||||
}
|
||||
|
||||
|
@ -3102,7 +3105,6 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
|
||||
// If we encounter a treat or projection use, we also want register the use for all subtypes.
|
||||
// We do this here to not have to expand entity name uses during pruning later on
|
||||
final EntityNameUse.UseKind useKind = finalEntityNameUse.getKind();
|
||||
if ( useKind == EntityNameUse.UseKind.TREAT ) {
|
||||
for ( EntityMappingType subType : persister.getSubMappingTypes() ) {
|
||||
entityNameUses.compute(
|
||||
|
|
Loading…
Reference in New Issue