У меня возникла проблема с выполнением подпроцесса HQL внутри case when statement.Hibernate Sub query in case when statement
вот мой код:
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
Спасибо за любую помощь!
Ok .. вот полный стек след
ERROR org.hibernate.hql.PARSER - <AST>:0:0: unexpected AST node: query
Exception in thread "Thread-5" 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(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.analyze(QueryTranslatorImpl.java:261)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
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:94)
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:1651)
какая ошибка дает? – ManuPK
org.hibernate.hql.ast.QuerySyntaxException: неожиданный узел АСТ –
до сих пор не знает! Отредактируйте вопрос и добавьте ** полную трассировку стека **! – ManuPK