[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2460) Multiple object creates on HQL select causes "unexpected token: , "

Jesse Sweetland (JIRA) noreply at atlassian.com
Wed Mar 9 21:11:08 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=40164#action_40164 ] 

Jesse Sweetland commented on HHH-2460:
--------------------------------------

EJB3 Persistence spec states in section 4.14 (EJB-QL BNF definition) that a select_clause is one or more select_expressions separated by commas, and a select_expression can be a constructor_expression.  This seems to indicate that this syntax is valid (per spec) and that this is a legitimate issue.

> Multiple object creates on HQL select causes "unexpected token: ,"
> ------------------------------------------------------------------
>
>                 Key: HHH-2460
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2460
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: query-hql
>    Affects Versions: 3.1.2
>         Environment: MySQL
>            Reporter: Steve Mayhew
>
> When executing this query:
>     select new java.lang.String('test1'), new java.lang.String('test2')
>     from SomeMappedClass
> You get a syntax error.  It does not matter what is in the from clause, result is always the same.
> [2007-03-01 16:51:29,349] [ERROR:org.hibernate.hql.PARSER] [] - line 1:37: unexpected token: ,
> [2007-03-01 16:51:29,365] [DEBUG:org.hibernate.hql.ast.AST] [] - --- HQL AST ---
>  \-[QUERY] 'query'
> org.hibernate.hql.ast.QuerySyntaxException: unexpected token: , near line 1, column 37 [select new java.lang.String('test1'), new java.lang.String('test2')
> from SomeMappedClass
> 	at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
> 	at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:244)
> 	at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:155)
> 	at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
> 	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
> 	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
> 	at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> 	at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:134)
> 	at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:113)
> 	at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1602)
> 	at net.jvnet.dev.hqe.ThreadHQLQueryExecution.run(Unknown Source)
> Caused by: line 1:37: unexpected token: ,
> 	at org.hibernate.hql.antlr.HqlBaseParser.selectFrom(HqlBaseParser.java:1145)
> 	at org.hibernate.hql.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:702)
> 	at org.hibernate.hql.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:296)
> 	at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:159)
> 	at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:238)
> 	... 9 more

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list