We're updating the issue view to help you get more done. 

HQL "x member of treat(y as Type).collections" fails to parse

Description

Parsing the following query throws a QuerySyntaxException:

TreatTest.java

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 public class TreatTest extends BaseCoreFunctionalTestCase { @Override public String[] getMappings() { return new String[] { "hql/Animal.hbm.xml" }; } @Test public void memberOfTreatTest() { final Session s = openSession(); s.createQuery( "select pet" + " from Animal pet, Animal owner" + " where pet member of treat (owner as Human).pets" ); s.close(); } }

Exception thrown:

1 2 3 4 5 6 7 8 9 10 11 12 13 org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: ( near line 1, column 114 [select pet from org.hibernate.test.hql.Animal pet, org.hibernate.test.hql.Animal owner where pet member of treat (owner as Human).pets] at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:91) at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:109) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:304) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:203) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:126) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:88) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167) at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:239) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800) at org.hibernate.test.hql.TreatTest.memberOfTreatTest(TreatTest.java:46)

Environment

None

Status

Assignee

Steve Ebersole

Reporter

Etienne Miret

Labels

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Affects versions

4.3.6
5.0.1

Priority

Major