Bug in JPA query parsing
------------------------
Key: HIBERNATE-47
URL:
http://jira.jboss.com/jira/browse/HIBERNATE-47
Project: Hibernate
Issue Type: Bug
Environment: ejb-3.0-fd-cr9
Reporter: Heiko W. Rupp
Assigned To: Steve Ebersole
JPA spec (ejb-3.0-fd) says on page 87 in section 4.4.6:
The syntax for declaring a collection member identification variable is as follows:
collection_member_declaration ::=
IN (collection_valued_path_expression) [AS] identification_variable
Using a query that makes use of IN (x.y) AS z fails:
ERROR 06-10 15:14:33,410 (Log4JLogger.java:error:114) -line 1:112: unexpected token: a
ERROR 06-10 15:14:33,502 (Log4JLogger.java:error:119) -Error in named query:
mes_templ_findByMeasurementArg
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: a near line 1, column 112
[SELECT mt FROM org.jboss.on.domain.measurement.MeasurementTempl AS mt, IN
(mt.eamMeasurementArgCollection1) AS a WHERE a.measurementTemplateArgId.id = :tid]
at
org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
at
org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:253)
at
org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:156)
at
org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:110)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at
org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
at
org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:397)
at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:348)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1213)
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:631)
at
org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:760)
at
org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:350)
at
org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:119)
at
org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
When I remove the "AS" in IN(x.y) AS z to make it read IN(x.y) z , then it
works.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira