Skip to content

Commit

Permalink
HHH-17299 Avoid unneeded treats to the same subtype
Browse files Browse the repository at this point in the history
  • Loading branch information
mbladel committed Nov 8, 2023
1 parent 01c8243 commit 4087774
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5212,7 +5212,7 @@ private Set<String> determineEntityNamesForTreatTypeRestriction(

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 );
}
Expand Down

0 comments on commit 4087774

Please sign in to comment.