Lucee 4.5.1 下,使用 Coldfusion/HQL,我收到以下错误:

Lucee 4.5.1.022 Error (org.hibernate.hql.ast.QuerySyntaxException)
Message     unexpected token: : near line 1, column 88 [from League where leagueID in (select leagueID from Game where seasonID=:sid and userID:=uid and showReportYN=1) order by leagueID]
Cause   org.hibernate.hql.ast.QuerySyntaxException
Stacktrace  The Error Occurred in
/my/file/code.cfm: line 39
...
39: qryLeagues = ORMExecuteQuery("from League where leagueID in (select leagueID from Game where seasonID=:sid and userID:=uid and showReportYN=1) order by leagueID", {sid=url.sid, uid=request.userID});
...

它似乎与 HQL 文档相匹配:
https://docs.jboss.org/hibernate/orm/4.3/devguide/en-US/html/ch11.html#d5e3400

而且,这个 SO 帖子似乎也表明它没问题:
unexpected token : ( subquery hql

不知道我错过了什么......

更新 #2

答案确实修复了它,但随后出现以下错误:
No data type for node: org.hibernate.hql.ast.tree.IdentNode

这是最终的工作查询(注意子查询中的类别名):
qryLeagues = ORMExecuteQuery("from League where leagueID in (select g.League.leagueID from Game g where g.Season.seasonID=:sid and g.Season.User.userID=:uid and g.League.showReportYN=1)",

最佳答案

您在第二个参数中切换了 =:(在第 88 个字符处)

and userID:=uid

应该
and userID=:uid

先用 = 再用 :

关于hibernate - Coldfusion HQL 查询异常 - 意外 token ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33832211/

10-13 02:37