The following query fails when I use createQuery
select MAX(kcc.order) From KPIConfiguration kcc join EnumerationValue ev on kcc.level = ev.enumerationValueId join EnumerationValue ev1 on kcc.dataSource = ev1.enumerationValueId where ev1.key = :dataSource
with the following exception
Exception: "Encountered "join EnumerationValue ev" at character 49,
but expected: [".", "FETCH", "INNER", "JOIN", "LEFT", ]."
while parsing JPQL "select MAX(kcc.order) From KPIConfiguration kcc
join EnumerationValue ev on kcc.level = ev.enumerationValueId join
EnumerationValue ev1 on kcc.dataSource = ev1.enumerationValueId where
ev1.key = :dataSource"
but when I use createNativeQuery as follows, it works.
select MAX(kcc.ORDERS) From KPI_CHECKLIST_CONF kcc join ENUMERATION_VALUE ev on kcc.LEVELS = ev.ENUMERATION_VALUE_ID join ENUMERATION_VALUE ev1 on kcc.DATA_SOURCE = ev1.ENUMERATION_VALUE_ID where ev1.ENUMERATION_KEY = ?1
I couldn't understand the reason. What am I missing?
question from:
https://stackoverflow.com/questions/65912933/jpql-create-query-throws-parsing-exception 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…