[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5209?page=c...
]
Gail Badner edited comment on HHH-5209 at 1/13/11 6:29 PM:
-----------------------------------------------------------
While debugging, I see that _t is set to ASTNULL, but the switch that immediately follows
does not have a case for ASTNullType
The following error gets logged:
16:27:48,817 ERROR PARSER:56 - <AST>:0:0: expecting "from", found
'<ASTNULL>'
Here's the stack:
at org.hibernate.hql.antlr.SqlGeneratorBase.selectClause(SqlGeneratorBase.java:523)
at org.hibernate.hql.antlr.SqlGeneratorBase.selectStatement(SqlGeneratorBase.java:175)
at org.hibernate.hql.antlr.SqlGeneratorBase.parenSelect(SqlGeneratorBase.java:3438)
at org.hibernate.hql.antlr.SqlGeneratorBase.inList(SqlGeneratorBase.java:3315)
at
org.hibernate.hql.antlr.SqlGeneratorBase.exoticComparisonExpression(SqlGeneratorBase.java:3158)
at org.hibernate.hql.antlr.SqlGeneratorBase.comparisonExpr(SqlGeneratorBase.java:1297)
at org.hibernate.hql.antlr.SqlGeneratorBase.booleanExpr(SqlGeneratorBase.java:910)
at org.hibernate.hql.antlr.SqlGeneratorBase.whereExpr(SqlGeneratorBase.java:768)
at org.hibernate.hql.antlr.SqlGeneratorBase.selectStatement(SqlGeneratorBase.java:191)
at org.hibernate.hql.antlr.SqlGeneratorBase.statement(SqlGeneratorBase.java:119)
at org.hibernate.hql.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:238)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:205)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
at
org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770)
at
org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:272)
at
org.hibernate.ejb.test.query.QueryTest.testMemberOfElementCollection(QueryTest.java:110)
was (Author: gbadner):
While debugging, I see that _t is set to ASTNULL, but the switch that immediately
follows does not have a case for ASTNullType
Here's the stack:
at org.hibernate.hql.antlr.SqlGeneratorBase.selectClause(SqlGeneratorBase.java:523)
at org.hibernate.hql.antlr.SqlGeneratorBase.selectStatement(SqlGeneratorBase.java:175)
at org.hibernate.hql.antlr.SqlGeneratorBase.parenSelect(SqlGeneratorBase.java:3438)
at org.hibernate.hql.antlr.SqlGeneratorBase.inList(SqlGeneratorBase.java:3315)
at
org.hibernate.hql.antlr.SqlGeneratorBase.exoticComparisonExpression(SqlGeneratorBase.java:3158)
at org.hibernate.hql.antlr.SqlGeneratorBase.comparisonExpr(SqlGeneratorBase.java:1297)
at org.hibernate.hql.antlr.SqlGeneratorBase.booleanExpr(SqlGeneratorBase.java:910)
at org.hibernate.hql.antlr.SqlGeneratorBase.whereExpr(SqlGeneratorBase.java:768)
at org.hibernate.hql.antlr.SqlGeneratorBase.selectStatement(SqlGeneratorBase.java:191)
at org.hibernate.hql.antlr.SqlGeneratorBase.statement(SqlGeneratorBase.java:119)
at org.hibernate.hql.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:238)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:205)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
at
org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770)
at
org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:272)
at
org.hibernate.ejb.test.query.QueryTest.testMemberOfElementCollection(QueryTest.java:110)
org.hibernate.hql.ast.QuerySyntaxException when running a JPQL query
with a MEMBER OF on an @ElementCollection
--------------------------------------------------------------------------------------------------------------
Key: HHH-5209
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5209
Project: Hibernate Core
Issue Type: Bug
Components: core, entity-manager
Affects Versions: 3.5.1, 3.6.0
Environment: Hibernate EM 3.5.1, HSQLDB, Derby, H2
Reporter: Pascal Thivent
Fix For: 3.6.1, 4.0.0.Alpha1
Attachments: QueryTest.patch
I have an entity with an attribute of type {{Set<String>}} annotated as
{{@ElementCollection}}. Running a query with a {{MEMBER OF}} on this attribute fails with
Hibernate (but works with the RI):
{code}
select user from User user where :role member of user.roles
{code}
This is valid JPQL but Hibernate is not able to generate the corresponding SQL properly:
{code:java}
java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException:
unexpected end of subtree [select user from org.hibernate.ejb.test.User user where :role
member of user.roles]
at
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1222)
at
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1168)
at
org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:271)
at
org.hibernate.ejb.test.query.QueryTest.testMemberOfElementCollection(QueryTest.java:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154)
at org.hibernate.test.annotations.HibernateTestCase.runTest(HibernateTestCase.java:95)
at org.hibernate.test.annotations.HibernateTestCase.runBare(HibernateTestCase.java:83)
at org.hibernate.ejb.test.TestCase.runBare(TestCase.java:224)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree [select
user from org.hibernate.ejb.test.User user where :role member of user.roles]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82)
at org.hibernate.hql.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:244)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:205)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:98)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1761)
at
org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:268)
... 19 more
{code}
I'm not sure this would be the right place (this seems to be a problem in Hibernate
Core actually) but I've implemented a test method in
{{org.hibernate.ejb.test.query.QueryTest}} demonstrating the problem. The patch is
attached.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira