HHH-17413 Avoid pruning table references used in type() expression
This commit is contained in:
parent
3d61b9658c
commit
6159713119
|
@ -3151,6 +3151,11 @@ 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
|
||||
final EntityMappingType mappingType = (EntityMappingType) tableGroup.getModelPart().getPartMappingType();
|
||||
final AbstractEntityPersister persister = (AbstractEntityPersister) mappingType.getEntityPersister();
|
||||
if ( getCurrentClauseStack().getCurrent() != Clause.WHERE && getCurrentClauseStack().getCurrent() != Clause.HAVING ) {
|
||||
// Where and having clauses are handled specially with EntityNameUse.FILTER and pruning
|
||||
registerEntityNameUsage( tableGroup, EntityNameUse.PROJECTION, persister.getEntityName(), true );
|
||||
}
|
||||
else {
|
||||
// Avoid doing this for single table entity persisters, as the table span includes secondary tables,
|
||||
// which we don't want to resolve, though we know that there is only a single table anyway
|
||||
if ( persister instanceof SingleTableEntityPersister ) {
|
||||
|
@ -3161,6 +3166,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
tableGroup.resolveTableReference( null, persister.getSubclassTableName( i ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void pruneTableGroupJoins() {
|
||||
for ( Map.Entry<TableGroup, Map<String, EntityNameUse>> entry : tableGroupEntityNameUses.entrySet() ) {
|
||||
|
|
Loading…
Reference in New Issue