TechFanDan
TechFanDan

Reputation: 3482

Coldfusion HQL query exception - unexpected token

Under Lucee 4.5.1, using Coldfusion/HQL, I'm getting the following error:

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});
...

It seems to match the HQL documentation: https://docs.jboss.org/hibernate/orm/4.3/devguide/en-US/html/ch11.html#d5e3400

And, this SO post, seems to also indicate that it's ok: unexpected token : ( subquery hql

Not sure what I'm missing...

Update #2

Answer did fix it, but then got the following error:

No data type for node: org.hibernate.hql.ast.tree.IdentNode

Here is the final working query (note class aliases in sub query):

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

Upvotes: 3

Views: 262

Answers (1)

Matt Busche
Matt Busche

Reputation: 14333

You have your = and : switched in your second param (at the 88th character)

and userID:=uid

should be

and userID=:uid

with the = first then then :

Upvotes: 3

Related Questions