在下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 帖子,似乎也表明它没关系: 意外令牌:(子查询 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)",