org.hibernate.hql.internal.ast.QuerySyntaxException: Invalid path: 'generatedAlias2.imgLocation' [select count(generatedAlias0) from com.centure.core.matching.entity.ImageForMatch as generatedAlias0 inner join generatedAlias0.image as generatedAlias1 where ( generatedAlias2.imgLocation<>:param0 ) and ( generatedAlias3.photographerName is not null ) and ( generatedAlias3.category=:param1 ) and ( generatedAlias0.level=1 )]

Hibernate JIRA | oaktree | 3 months ago
  1. 0

    Just upgraded from {{Hibernate 5.1.0 Final}} to {{Hibernate 5.2.2 Final}} and got following produced JPQL from hibernate. {{Invalid path: 'generatedAlias2.imgLocation' }} The following code can reproduce the issue {quote} Join<A, B> somefield= root.join(A.image, JoinType.INNER); Predicate notEmpty = cb.notEqual(cb.treat(somefield,B.class).get(B_.somefield), ""); {quote} We are using {{JPA criteria}} and mainly we do not write {{free text}}. It seems that the cause for the error is using {{treat}} function: removing the use of {{treat}} function makes the issue disappear {quote}SELECT count(generatedAlias0) FROM com.centure.core.matching.entity.ImageForMatch AS generatedAlias0 INNER JOIN generatedAlias0.image AS generatedAlias1 WHERE (generatedAlias2.imgLocation<>:param0) AND (generatedAlias3.photographerName IS NOT NULL) AND (generatedAlias3.category=:param1) AND (generatedAlias0.level=1){quote} It is clear that something went wrong and there generatedAlias2 and generatedAlias3 does not exist.... bq. Sep 08, 2016 12:49:08 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [spring] in context with path [/] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.hql.internal.ast.QuerySyntaxException: Invalid path: 'generatedAlias2.imgLocation' [select count(generatedAlias0) from com.centure.core.matching.entity.ImageForMatch as generatedAlias0 inner join generatedAlias0.image as generatedAlias1 where ( generatedAlias2.imgLocation<>:param0 ) and ( generatedAlias3.photographerName is not null ) and ( generatedAlias3.category=:param1 ) and ( generatedAlias0.level=1 )]; nested exception is java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: Invalid path: 'generatedAlias2.imgLocation' [select count(generatedAlias0) from com.centure.core.matching.entity.ImageForMatch as generatedAlias0 inner join generatedAlias0.image as generatedAlias1 where ( generatedAlias2.imgLocation<>:param0 ) and ( generatedAlias3.photographerName is not null ) and ( generatedAlias3.category=:param1 ) and ( generatedAlias0.level=1 )]] with root cause org.hibernate.hql.internal.ast.QuerySyntaxException: Invalid path: 'generatedAlias2.imgLocation' [select count(generatedAlias0) from com.centure.core.matching.entity.ImageForMatch as generatedAlias0 inner join generatedAlias0.image as generatedAlias1 where ( generatedAlias2.imgLocation<>:param0 ) and ( generatedAlias3.photographerName is not null ) and ( generatedAlias3.category=:param1 ) and ( generatedAlias0.level=1 )] at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:74) at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:91) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:268) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:190) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:142) 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:152) at org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:526) at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:628) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:3285) at org.hibernate.query.criteria.internal.CriteriaQueryImpl$1.buildCompiledQuery(CriteriaQueryImpl.java:318) at org.hibernate.query.criteria.internal.compile.CriteriaCompiler.compile(CriteriaCompiler.java:127) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:3578) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:203) at sun.reflect.GeneratedMethodAccessor763.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:298) at com.sun.proxy.$Proxy129.createQuery(Unknown Source) at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getCountQuery(SimpleJpaRepository.java:685) at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getCountQuery(SimpleJpaRepository.java:659) at org.springframework.data.jpa.repository.support.SimpleJpaRepository.count(SimpleJpaRepository.java:495) at sun.reflect.GeneratedMethodAccessor1041.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:503) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:488) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:280) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) at com.sun.proxy.$Proxy146.count(Unknown Source) at sun.reflect.GeneratedMethodAccessor1616.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java) at java.lang.reflect.Method.invoke(Method.java:498) at org.zeroturnaround.javarebel.integration.util.ReloadingProxyFactory$ReloadingMethodHandler.invoke(SourceFile:74) at com.sun.proxy.$Proxy146.count(Unknown Source) at sun.reflect.GeneratedMethodAccessor1616.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java) at java.lang.reflect.Method.invoke(Method.java:498) at org.zeroturnaround.javarebel.integration.util.ReloadingProxyFactory$ReloadingMethodHandler.invoke(SourceFile:74) at com.sun.proxy.$Proxy146.count(Unknown Source) at com.centure.core.m

    Hibernate JIRA | 3 months ago | oaktree
    org.hibernate.hql.internal.ast.QuerySyntaxException: Invalid path: 'generatedAlias2.imgLocation' [select count(generatedAlias0) from com.centure.core.matching.entity.ImageForMatch as generatedAlias0 inner join generatedAlias0.image as generatedAlias1 where ( generatedAlias2.imgLocation<>:param0 ) and ( generatedAlias3.photographerName is not null ) and ( generatedAlias3.category=:param1 ) and ( generatedAlias0.level=1 )]
  2. 0

    org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: * near line 1

    Stack Overflow | 1 year ago | Crazy Coder
    org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: * near line 1, column 8 [SELECT * FROM com.rhcloud.giveme.entity.User u WHERE u.email = :email]
  3. 0

    hibernate class is not mapped

    Stack Overflow | 4 years ago | Султан Абубакиров
    org.hibernate.hql.internal.ast.QuerySyntaxException: drivers is not mapped [select d from drivers d , busses b where d.id = b.id and b.id =: busid] Bus # 10
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    HQL error: with-clause referenced two different from-clause elements

    Stack Overflow | 3 years ago | Douglas
    org.hibernate.hql.internal.ast.QuerySyntaxException: with-clause referenced two different from-clause elements [select t.id, t.name, t.src_field_map.id, s1.field_map_nm as src_field_map_nm,t.tgt_field_map.id, s2.field_map_nm as tgt_field_map_nm, orm.entity.OS_Rule as t left join t.src_field_map as s1 left join t.tgt_field_map as s2 with (s1.id = t.src_field_map.id and s2.id = t.tgt_field_map.id )]
  6. 0

    Spring boot + Hibernate - User is not mapped

    codegur.online | 4 months ago
    org.hibernate.hql.internal.ast.QuerySyntaxException: User is not mapped

  1. MoYapro 1 times, last 1 week ago
  2. MoYapro 1 times, last 1 month ago
  3. marcbouvierdav 1 times, last 2 months ago
  4. tfr 1 times, last 4 months ago
  5. davidvanlaatum 1 times, last 5 months ago
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

    Invalid path: 'generatedAlias2.imgLocation' [select count(generatedAlias0) from com.centure.core.matching.entity.ImageForMatch as generatedAlias0 inner join generatedAlias0.image as generatedAlias1 where ( generatedAlias2.imgLocation<>:param0 ) and ( generatedAlias3.photographerName is not null ) and ( generatedAlias3.category=:param1 ) and ( generatedAlias0.level=1 )]

    at org.hibernate.hql.internal.ast.QuerySyntaxException.convert()
  2. Hibernate
    SessionImpl.createQuery
    1. org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:74)
    2. org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:91)
    3. org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:268)
    4. org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:190)
    5. org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:142)
    6. org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:115)
    7. org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
    8. org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:152)
    9. org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:526)
    10. org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:628)
    11. org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:3285)
    11 frames
  3. org.hibernate.query
    CriteriaCompiler.compile
    1. org.hibernate.query.criteria.internal.CriteriaQueryImpl$1.buildCompiledQuery(CriteriaQueryImpl.java:318)
    2. org.hibernate.query.criteria.internal.compile.CriteriaCompiler.compile(CriteriaCompiler.java:127)
    2 frames
  4. Hibernate
    SessionImpl.createQuery
    1. org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:3578)
    2. org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:203)
    2 frames
  5. Java RT
    Method.invoke
    1. sun.reflect.GeneratedMethodAccessor763.invoke(Unknown Source)
    2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
    3. java.lang.reflect.Method.invoke(Method.java:498)
    3 frames
  6. Spring ORM
    SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke
    1. org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:298)
    1 frame
  7. com.sun.proxy
    $Proxy129.createQuery
    1. com.sun.proxy.$Proxy129.createQuery(Unknown Source)
    1 frame
  8. Spring Data JPA
    SimpleJpaRepository.count
    1. org.springframework.data.jpa.repository.support.SimpleJpaRepository.getCountQuery(SimpleJpaRepository.java:685)
    2. org.springframework.data.jpa.repository.support.SimpleJpaRepository.getCountQuery(SimpleJpaRepository.java:659)
    3. org.springframework.data.jpa.repository.support.SimpleJpaRepository.count(SimpleJpaRepository.java:495)
    3 frames
  9. Java RT
    Method.invoke
    1. sun.reflect.GeneratedMethodAccessor1041.invoke(Unknown Source)
    2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
    3. java.lang.reflect.Method.invoke(Method.java:498)
    3 frames
  10. Spring Data Core
    RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke
    1. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:503)
    2. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:488)
    3. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460)
    3 frames
  11. Spring AOP
    ReflectiveMethodInvocation.proceed
    1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    1 frame
  12. org.springframework.data
    DefaultMethodInvokingMethodInterceptor.invoke
    1. org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)
    1 frame
  13. Spring AOP
    ReflectiveMethodInvocation.proceed
    1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    1 frame
  14. Spring Tx
    TransactionInterceptor.invoke
    1. org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    2. org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:280)
    3. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    3 frames
  15. Spring AOP
    ReflectiveMethodInvocation.proceed
    1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    1 frame
  16. Spring Tx
    PersistenceExceptionTranslationInterceptor.invoke
    1. org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
    1 frame
  17. Spring AOP
    ReflectiveMethodInvocation.proceed
    1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    1 frame
  18. Spring Data JPA
    CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke
    1. org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133)
    1 frame
  19. Spring AOP
    JdkDynamicAopProxy.invoke
    1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    2. org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    4. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
    4 frames
  20. com.sun.proxy
    $Proxy146.count
    1. com.sun.proxy.$Proxy146.count(Unknown Source)
    1 frame
  21. Java RT
    Method.invoke
    1. sun.reflect.GeneratedMethodAccessor1616.invoke(Unknown Source)
    2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
    3. java.lang.reflect.Method.invoke(Method.java:498)
    3 frames
  22. JavaRebel Utils
    ReloadingProxyFactory$ReloadingMethodHandler.invoke
    1. org.zeroturnaround.javarebel.integration.util.ReloadingProxyFactory$ReloadingMethodHandler.invoke(SourceFile:74)
    1 frame
  23. com.sun.proxy
    $Proxy146.count
    1. com.sun.proxy.$Proxy146.count(Unknown Source)
    1 frame
  24. Java RT
    Method.invoke
    1. sun.reflect.GeneratedMethodAccessor1616.invoke(Unknown Source)
    2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java)
    3. java.lang.reflect.Method.invoke(Method.java:498)
    3 frames
  25. JavaRebel Utils
    ReloadingProxyFactory$ReloadingMethodHandler.invoke
    1. org.zeroturnaround.javarebel.integration.util.ReloadingProxyFactory$ReloadingMethodHandler.invoke(SourceFile:74)
    1 frame
  26. com.sun.proxy
    $Proxy146.count
    1. com.sun.proxy.$Proxy146.count(Unknown Source)
    1 frame