Collection member declaration not handling optional AS in HQL.

Description

HQL:

SELECT o FROM EntityBean AS o, IN (o.items) AS l WHERE l.itemValue = '1'

The log output gives the following:

2010-11-10 16:03:53,286 DEBUG [org.hibernate.hql.ast.QueryTranslatorImpl] (WorkerThread#0[127.0.0.1:60518]) parse() - HQL: SELECT o FROM EntityBean AS o, IN (o.items) AS l WHERE l.itemValue = '1'

2010-11-10 16:03:53,290 DEBUG [org.hibernate.hql.PARSER] (WorkerThread#0[127.0.0.1:60518]) Keyword 'AS' is being interpreted as an identifier due to: expecting IDENT, found 'AS'

2010-11-10 16:03:53,403 ERROR [org.hibernate.hql.PARSER] (WorkerThread#0[127.0.0.1:60518]) line 1:48: unexpected token: l

According to the jpa persistence spec the AS keyword is optional for collection declarations:

collection_member_declaration ::=
IN (collection_valued_path_expression) [AS] identification_variable

In hql.g we have:

inCollectionDeclaration!
: IN! OPEN! path CLOSE! a:alias
{ #inCollectionDeclaration = #([JOIN, "join"], [INNER, "inner"], #p, #a); }
;

Should this be a:asAlias rather than a:alias?

Workaround: Do not use option AS, only identifier in the HQL for collection.

Environment

None

Assignee

Strong Liu

Reporter

Dave Stephan

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

Affirmative

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure