Hello, I have two entities:
@Entity("product")
public class Product {
}
and
@Entity("variant_product")
public class VariantProduct extends Product {
}
Now I call the following query:
select p from product p where TREAT(p AS variant_product).baseProduct is null and p.catalogVersion in :catalogVersions
and I get the following exception:
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: i.getText().equals("treat") [select p from com.nemesis.platform.module.commerce.core.entity.catalog.ProductEntity p where TREAT(p AS variant_product).baseProduct is null and p.catalogVersion in :catalogVersions]
at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:74)
at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:91)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:288)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:187)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:142)
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:115)
at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:76)
at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:150)
at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:302)
at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:240)
at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1907)
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:291)
... 208 more
I marked it as critical because I think this breaks the JPA specification. |