Amit Kumar
Amit Kumar

Reputation: 2745

Hibernate query syntax error?

from (From FlightSchedule as a where a.route.routeId=1) as b

What is wrong in above query? It gives me this error

org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: ( near line 1, column 6 [from
 (From FlightSchedule as a where a.route.routeId=1) as b]

I have tried to write it in different ways but that don't work. What I suppose is that the inner query should evaluate to a list of objects and the same should be returned by the first from token? Please tell me what I am doing wrong? Thank you.

Upvotes: 1

Views: 1529

Answers (1)

JB Nizet
JB Nizet

Reputation: 692281

Your assumptions are wrong. This is invalid HQL. Quote from the documentation:

Note that HQL subqueries can occur only in the select or where clauses.

Upvotes: 3

Related Questions