HHH-17727 Avoid name uses for subtypes when selecting discriminator only
This commit is contained in:
parent
dfb56c2f36
commit
34374c0c70
|
@ -3176,15 +3176,15 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
// The AND junction allows to create an intersection of entity name lists of all sub-predicates
|
// The AND junction allows to create an intersection of entity name lists of all sub-predicates
|
||||||
final EntityMappingType mappingType = (EntityMappingType) tableGroup.getModelPart().getPartMappingType();
|
final EntityMappingType mappingType = (EntityMappingType) tableGroup.getModelPart().getPartMappingType();
|
||||||
final AbstractEntityPersister persister = (AbstractEntityPersister) mappingType.getEntityPersister();
|
final AbstractEntityPersister persister = (AbstractEntityPersister) mappingType.getEntityPersister();
|
||||||
|
// Avoid resolving subclass tables for persisters with physical discriminators as we won't need them
|
||||||
|
if ( persister.getDiscriminatorMapping().hasPhysicalColumn() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ( getCurrentClauseStack().getCurrent() != Clause.WHERE && getCurrentClauseStack().getCurrent() != Clause.HAVING ) {
|
if ( getCurrentClauseStack().getCurrent() != Clause.WHERE && getCurrentClauseStack().getCurrent() != Clause.HAVING ) {
|
||||||
// Where and having clauses are handled specially with EntityNameUse.FILTER and pruning
|
// Where and having clauses are handled specially with EntityNameUse.FILTER and pruning
|
||||||
registerEntityNameUsage( tableGroup, EntityNameUse.PROJECTION, persister.getEntityName(), true );
|
registerEntityNameUsage( tableGroup, EntityNameUse.PROJECTION, persister.getEntityName(), true );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Avoid resolving subclass tables for persisters with physical discriminators as we won't need them
|
|
||||||
if ( persister.getDiscriminatorMapping().hasPhysicalColumn() ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final int subclassTableSpan = persister.getSubclassTableSpan();
|
final int subclassTableSpan = persister.getSubclassTableSpan();
|
||||||
for ( int i = 0; i < subclassTableSpan; i++ ) {
|
for ( int i = 0; i < subclassTableSpan; i++ ) {
|
||||||
tableGroup.resolveTableReference( null, persister.getSubclassTableName( i ) );
|
tableGroup.resolveTableReference( null, persister.getSubclassTableName( i ) );
|
||||||
|
|
Loading…
Reference in New Issue