提问者:小点点

Coldfusion HQL查询异常-意外标记


Lucee 4.5.1下,使用Coldsion/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帖子似乎也表明没关系:意外令牌:(子查询hql

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

更新#2

Answer确实修复了它,但随后出现以下错误:

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)",

共1个答案

匿名用户

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

and userID:=uid

应该是

and userID=:uid

首先使用 = 然后: