org.hibernate.hql.internal.ast.QuerySyntaxException: Path expected for join! [from it.jack.fdd.domain.Staff inner join RtStaffDispenser on Staff.idstaff = RtStaffDispenser.idrtStaffDispenser]

  1. 0

    Hibernate: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: ( near line 1, column 6...)

    Stack Overflow | 1 year ago | Maurizio Rizzo
    org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: ( near line 1, column 6 [from (select nomeFeed, title, max(pubDate) as maxdate from it.unirc.fantapjam.FeedMessage.Model.FeedMessage group by nomeFeed) as x inner join FeedMessage as f on f.nomeFeed = x.nomeFeed and f.pubDate = x.maxdate]
  2. 0

    {code} ... org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST node: NULL near line 1, column 59 [SELECT NEW support.hibernate.dto.EmployeeDTO(e.name, CAST(NULL as long), e.title) FROM support.hibernate.entity.Employee e WHERE e.name = :name] at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54) at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47) at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:79) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:240) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:205) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:138) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:104) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:79) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168) at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:222) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:200) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1703) at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:301) ... {code} Executing a query like the below {code} final String hql = "SELECT NEW support.hibernate.dto.EmployeeDTO(e.name, CAST(NULL as long), e.title) FROM Employee e WHERE e.name = :name"; {code} Looks like something changed between Hibernate 4.2.7.SP5-redhat-1 (EAP 6.2.4) and Hibernate 4.2.14.SP1-redhat-1 (EAP 6.3.0) with regard to antlr parsing so that the keyword 'NULL' causes a parse failure in the HQL query. The issue remains in 5.0.9 and 5.1.0 Replacing the 'CAST(NULL as long)' with 'CAST(12 as long)' works ... If the query in question is a {{@NamedQuery}} the failure will be at the point the entity manager is created. The same issue can be seen with a simple dynamic HQL query, however, as the testcase attached shows. The test uses an H2 db and can be run using 'mvn clean test'

    Hibernate JIRA | 8 months ago | Stephen Fikes
    org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST node: NULL near line 1, column 59 [SELECT NEW support.hibernate.dto.EmployeeDTO(e.name, CAST(NULL as long), e.title) FROM support.hibernate.entity.Employee e WHERE e.name = :name]
  3. 0

    i have a Errors in Hibernate Query

    Coderanch | 7 years ago | Mark Kafe
    java.lang.RuntimeException: org.hibernate.hql.ast.QuerySyntaxException: Path expected for join! [select P.peopleId,P.firstName,P.surname,P.position,Ptt.title from com.itcentrix.altcp.People.People as P LEFT OUTER JOIN PplTitle as Ptt]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Left join query

    Coderanch | 5 years ago | krunal prajapati
    org.hibernate.hql.ast.QuerySyntaxException: Path expected for join! [select me.meDsidioma,u4.u4Dstexto from tid.cip.bd.prepago120000.impl.MeIdiomas me left join U4Textosussds u4 WHERE me.meNuidoma=u4.u4Menuidioma]
  6. 0

    The JPQL "select e from Employee e where e.skills is not empty" failes with the exception Exception in thread "main" java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected end of subtree [select e from de.gedoplan.buch.eedemos.entity.Employee e where e.skills is not empty ] at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1334) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1280) at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:283) at de.gedoplan.buch.eedemos.entity.QueryTester.main(QueryTester.java:19) Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected end of subtree [select e from de.gedoplan.buch.eedemos.entity.Employee e where e.skills is not empty ] at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:53) at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:46) at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:79) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:238) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:203) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:101) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:120) at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:214) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:192) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1538) at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:280) ... 1 more The attribute skills used in the where clause is a simple @ElementCollection List<String>. Attached files are the entity class (Employee.java) and a short main programm for executing JPQL (QueryTester.java).

    Hibernate JIRA | 5 years ago | Dirk weil
    java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected end of subtree [select e from de.gedoplan.buch.eedemos.entity.Employee e where e.skills is not empty ]

  1. richard77 1 times, last 1 month ago
  2. MoYapro 2 times, last 1 month ago
  3. MoYapro 1 times, last 3 months ago
  4. marcbouvierdav 1 times, last 3 months ago
  5. tfr 1 times, last 6 months ago
1 more registered users
30 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.hibernate.hql.internal.ast.QuerySyntaxException

    Path expected for join! [from it.jack.fdd.domain.Staff inner join RtStaffDispenser on Staff.idstaff = RtStaffDispenser.idrtStaffDispenser]

    at org.hibernate.hql.internal.ast.QuerySyntaxException.convert()
  2. Hibernate
    SessionImpl.createQuery
    1. org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:91)
    2. org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:109)
    3. org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:284)
    4. org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:206)
    5. org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158)
    6. org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:126)
    7. org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:88)
    8. org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:190)
    9. org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301)
    10. org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
    11. org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800)
    11 frames
  3. it.jack.fdd
    StaffDaoImplTest.testGetAllA
    1. it.jack.fdd.dao.impl.StaffDaoImpl.getAllA(StaffDaoImpl.java:95)
    2. it.jack.fdd.tests.StaffDaoImplTest.testGetAllA(StaffDaoImplTest.java:62)
    2 frames
  4. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:497)
    4 frames
  5. JUnit
    ParentRunner.run
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    5. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    6. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    7. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    8. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    9. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    10. org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    11. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    12. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    13. org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    14. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    15. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    16. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    17. org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    17 frames
  6. JUnit4 Runner
    JUnit4TestReference.run
    1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    1 frame
  7. JUnit3 Runner
    RemoteTestRunner.main
    1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    5 frames