Uploaded image for project: 'Hibernate ORM'
  1. HHH-11784

HQL query fails if entity is inside a package which starts with "in" or "by"

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: 5.2.10
    • Fix versions: 6.0.0.Beta1
    • Components: query-hql
    • Labels:
    • Environment:
      Hibernate version 5.2.10
      Fails on all database platforms, query parsing fails.
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      Bug

      When the entities are inside packages which starts with "in", hql query fails to execute. I have tried adding `name` parameter for @Entity, which didnt resolve the issue.

      Exception

      Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: expecting OPEN, found '.' near line 1, column 37 [select e1 from in.test.Event2 e1, in.test.EventDetails2 e2 where e2.text = :text and e2.event=e1]

      JPA Test case : https://github.com/farhan-anwar/hibernate-test-case-templates/tree/master/orm/hibernate-orm-5

      Stack Trace

      2017-06-02 14:11:36 ERROR ErrorCounter:60 - line 1:37: expecting OPEN, found '.'
      2017-06-02 14:11:36 ERROR ErrorCounter:55 - line 1:37: expecting OPEN, found '.'
      line 1:37: expecting OPEN, found '.'
      at antlr.Parser.match(Parser.java:211)
      at org.hibernate.hql.internal.antlr.HqlBaseParser.inCollectionDeclaration(HqlBaseParser.java:2030)
      at org.hibernate.hql.internal.antlr.HqlBaseParser.fromRange(HqlBaseParser.java:1506)
      at org.hibernate.hql.internal.antlr.HqlBaseParser.fromClause(HqlBaseParser.java:1360)
      at org.hibernate.hql.internal.antlr.HqlBaseParser.selectFrom(HqlBaseParser.java:1060)
      at org.hibernate.hql.internal.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:745)
      at org.hibernate.hql.internal.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:316)
      at org.hibernate.hql.internal.antlr.HqlBaseParser.statement(HqlBaseParser.java:198)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:283)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:186)
      at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:141)
      at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:115)
      at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
      at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:153)
      at org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:546)
      at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:655)
      at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:23)
      at org.hibernate.bugs.JPAUnitTestCase.entitiesWithPackageNameWithInFails(JPAUnitTestCase.java:97)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
      at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
      at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
      at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
      at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: