Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
140 views
in Technique[技术] by (71.8m points)

java - JPQL create Query Throws parsing exception

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...