HHH-17299 Avoid unneeded treats to the same subtype
This commit is contained in:
parent
1ddf519b76
commit
b4dabaeadd
|
@ -5214,7 +5214,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
|
||||
private Predicate createTreatTypeRestriction(SqmPath<?> lhs, EntityDomainType<?> treatTarget) {
|
||||
final AbstractEntityPersister entityDescriptor = (AbstractEntityPersister) domainModel.findEntityDescriptor( treatTarget.getHibernateEntityName() );
|
||||
if ( entityDescriptor.isPolymorphic() ) {
|
||||
if ( entityDescriptor.isPolymorphic() && lhs.getNodeType() != treatTarget ) {
|
||||
final Set<String> subclassEntityNames = entityDescriptor.getSubclassEntityNames();
|
||||
return createTreatTypeRestriction( lhs, subclassEntityNames );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue