org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: query [select case when a.entityId is null then 'invalid' else (select b.entityName from tblName b where b.entityId =a.entityId) end from tblEntity a]

  1. 0

    Hibernate Sub query inside case when statement

    Stack Overflow | 5 years ago | Recto jr. Caramat
    org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: query [select case when a.entityId is null then 'invalid' else (select b.entityName from tblName b where b.entityId =a.entityId) end from tblEntity a]
  2. 0

    org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class XXX解决--kkb2002的文章--CFANZ社区--IT技术分享网站

    cfanz.cn | 11 months ago
    org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [com.lo.entities.User] [select new User(u.userName,u.userAge) from com.lo.entities.User u]
  3. 0

    How to use inner join query in hql?

    Stack Overflow | 2 years ago | Akshant poonia
    org.hibernate.hql.ast.QuerySyntaxException: unexpected token: on near line 1, column 74 [select user_name, message from com.csc.project.user e inner join tweet p on p.user_id=e.id where e.user_name=:name]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Hibernate Community • View topic - Using List in HQL WHERE clause

    hibernate.org | 7 months ago
    org.springframework.orm.hibernate3.HibernateQueryException: expecting IDENT, found ':' near line 1, column 175 [select l from Location as l where l.latitude = :lat and l.longitude = :long and l.category.code in elements(:codes)]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: expecting IDENT, found ':' near line 1, column 175 [select l from Location as l where l.latitude = :lat and l.longitude = :long and l.category.code in elements(:codes)]
  6. 0

    If you call CriteriaBuilder.function() respectively "ParameterizedFunctionExpression" with two or more arguments you get an IllegalArgumentException. I think the bug is here: protected void renderArguments(StringBuilder buffer, CriteriaQueryCompiler.RenderingContext renderingContext) { for ( Expression argument : argumentExpressions ) { buffer.append( ( (Renderable) argument ).render( renderingContext ) ); } } The arguments are not seperated by comma. Exception: Exception in thread "main" java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: : near line 1, column 37 [select TO_CHAR(generatedAlias0.date1:param0) from test.server.TestBean as generatedAlias0] at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1166) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1112) at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:315) at org.hibernate.ejb.criteria.CriteriaQueryCompiler.compile(CriteriaQueryCompiler.java:154) at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:432) at test.server.TestApp.main(TestApp.java:28) Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: : near line 1, column 37 [select TO_CHAR(generatedAlias0.date1:param0) from test.server.TestBean as generatedAlias0] 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.parse(QueryTranslatorImpl.java:284) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:182) 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:1760) at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:297) ... 3 more Code: EntityManagerFactory factory = Persistence.createEntityManagerFactory("userDatabase"); EntityManager em = factory.createEntityManager(); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<String> createQuery = cb.createQuery(String.class); Root<TestBean> from = createQuery.from(TestBean.class); Expression<String> param = cb.literal("DD.MM.YYYY"); createQuery.select(cb.function("TO_CHAR", String.class, from.get(TestBean_.date1), param)); List<String> resultList = em.createQuery(createQuery).getResultList();

    Hibernate JIRA | 7 years ago | Max Hartmann
    java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: : near line 1, column 37 [select TO_CHAR(generatedAlias0.date1:param0) from test.server.TestBean as generatedAlias0]

    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 AST node: query [select case when a.entityId is null then 'invalid' else (select b.entityName from tblName b where b.entityId =a.entityId) end from tblEntity a]

      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.analyze(QueryTranslatorImpl.java:261)
      5. org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
      6. org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
      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:1651)
      6 frames