Coldfusion HQL 查询异常 - 意外标记
Coldfusion HQL query exception - unexpected token
在 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 post,似乎也表明没问题:
不确定我错过了什么...
更新 #2
答案确实修复了它,但随后出现以下错误:
No data type for node: org.hibernate.hql.ast.tree.IdentNode
这是最终的工作查询(注意子查询中的 class 别名):
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
先 =
然后 :
在 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 post,似乎也表明没问题:
不确定我错过了什么...
更新 #2
答案确实修复了它,但随后出现以下错误:
No data type for node: org.hibernate.hql.ast.tree.IdentNode
这是最终的工作查询(注意子查询中的 class 别名):
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
先 =
然后 :