HHH-15917 Unrelated Entity Join throws IllegalStateException

This commit is contained in:
Andrea Boriero 2023-07-19 12:22:27 +02:00 committed by Andrea Boriero
parent b0ac15af42
commit 085fd88a7f
1 changed files with 3 additions and 1 deletions

View File

@ -14,6 +14,7 @@ import java.util.Map;
import java.util.function.Function;
import org.hibernate.jpa.spi.JpaCompliance;
import org.hibernate.metamodel.model.domain.BasicDomainType;
import org.hibernate.metamodel.model.domain.spi.JpaMetamodelImplementor;
import org.hibernate.query.hql.HqlLogging;
import org.hibernate.query.hql.spi.SqmCreationProcessingState;
@ -248,7 +249,8 @@ public class SqmPathRegistryImpl implements SqmPathRegistry {
}
private boolean definesAttribute(SqmPathSource<?> containerType, String name) {
return containerType.findSubPathSource( name, getJpaMetamodel() ) != null;
return !( containerType.getSqmType() instanceof BasicDomainType )
&& containerType.findSubPathSource( name, getJpaMetamodel() ) != null;
}
private JpaMetamodelImplementor getJpaMetamodel() {