org.hibernate.hql.ast.QuerySyntaxException: unexpected token: And near line 1, column 697 [SELECT distinct d FROM com.natixis.smartcontestation.emetteur.entite.ReglementClient r JOIN FETCH d.etablissement e And r.statut in('Validé') And e.code = ]

Stack Overflow | Nabil Salah | 10 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Get input query from batch parameters

    Stack Overflow | 10 months ago | Nabil Salah
    org.hibernate.hql.ast.QuerySyntaxException: unexpected token: And near line 1, column 697 [SELECT distinct d FROM com.natixis.smartcontestation.emetteur.entite.ReglementClient r JOIN FETCH d.etablissement e And r.statut in('Validé') And e.code = ]
  2. 0

    db:: 3.65::JVM 1.3.1* crashes on WL 6.1 zz

    hivmr.com | 10 months ago
    javax.servlet.ServletException: /item/ItemList.xhtml @189,58 value="#{itemList.lastFirstResult}": Error reading 'lastFirstResult' on type com.celestica.orders.session.seamgen.ItemList_$$_javassist_seam_17
  3. 0

    REGEX in OQL Query

    Stack Overflow | 2 years ago | user3607869
    java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: REGEXP near line 1, column 74 [SELECT o FROM centina.sa.model.topology.NetworkElement o WHERE ((o.name REGEXP '^d') ) ]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    GitHub comment 1554#140670317

    GitHub | 2 years ago | leofromgroza
    org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: [select user from org.package.User user inner join user.properties as user_properties_5d0f0 with key(user_properties_5d0f0) = ?1 where user_properties_5d0f0 = ?2]
  6. 0

    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.

    Hibernate JIRA | 7 years ago | Pascal Thivent
    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]

    6 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.ast.QuerySyntaxException

      unexpected token: And near line 1, column 697 [SELECT distinct d FROM com.natixis.smartcontestation.emetteur.entite.ReglementClient r JOIN FETCH d.etablissement e And r.statut in('Validé') And e.code = ]

      at org.hibernate.hql.ast.QuerySyntaxException.convert()
    2. Hibernate HQL/JP-QL Parser
      QueryTranslatorImpl.compile
      1. org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
      2. org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
      3. org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82)
      4. org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:281)
      5. org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:180)
      6. org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:134)
      6 frames
    3. Hibernate
      SessionImpl.createQuery
      1. org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
      2. org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
      3. org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
      4. org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
      5. org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
      6. org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1650)
      6 frames
    4. Hibernate EJB
      AbstractEntityManagerImpl.createQuery
      1. org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:93)
      1 frame