-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: unexpected AST node: query
PostPosted: Tue Apr 10, 2007 5:28 am 
Newbie

Joined: Mon Feb 26, 2007 12:51 am
Posts: 7
im using IBM DB2

when i use case statement in my named query (HQL)
im getting the following error



[4/10/07 14:43:23:937 GMT+05:30] 5d70923e PARSER E org.hibernate.hql.PARSER *** ERROR: <AST>:0:0: unexpected AST node: query

[4/10/07 14:43:23:937 GMT+05:30] 5d70923e PARSER E org.hibernate.hql.PARSER *** ERROR: <AST>:0:0: unexpected AST node: query

[4/10/07 14:43:23:953 GMT+05:30] 5d70923e PARSER E org.hibernate.hql.PARSER *** ERROR: <AST>:0:0: unexpected AST node: query

[4/10/07 14:43:23:953 GMT+05:30] 5d70923e PARSER E org.hibernate.hql.PARSER *** ERROR: <AST>:0:0: unexpected AST node: query
[4/10/07 14:43:23:969 GMT+05:30] 5d70923e SystemErr R java.lang.NullPointerException
[4/10/07 14:43:24:031 GMT+05:30] 5d70923e SystemErr R at org.hibernate.hql.ast.CaseNode.getDataType(CaseNode.java:15)
[4/10/07 14:43:24:047 GMT+05:30] 5d70923e SystemErr R at org.hibernate.hql.ast.SelectClause.initializeExplicitSelectClause(SelectClause.java:134)
[4/10/07 14:43:24:047 GMT+05:30] 5d70923e SystemErr R at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:440)
[4/10/07 14:43:24:047 GMT+05:30] 5d70923e SystemErr R at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:351)
[4/10/07 14:43:24:047 GMT+05:30] 5d70923e SystemErr R at org.hibernate.hql.antlr.HqlSqlBaseWalker.afterQuery(HqlSqlBaseWalker.java:126)
[4/10/07 14:43:24:047 GMT+05:30] 5d70923e SystemErr R at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:471)
[4/10/07 14:43:24:047 GMT+05:30] 5d70923e SystemErr R at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201)
[4/10/07 14:43:24:047 GMT+05:30] 5d70923e SystemErr R at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151)
[4/10/07 14:43:24:047 GMT+05:30] 5d70923e SystemErr R at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
[4/10/07 14:43:24:047 GMT+05:30] 5d70923e SystemErr R at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
[4/10/07 14:43:24:047 GMT+05:30] 5d70923e SystemErr R at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
[4/10/07 14:43:24:078 GMT+05:30] 5d70923e SystemErr R at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
[4/10/07 14:43:24:078 GMT+05:30] 5d70923e SystemErr R at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:38


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 10, 2007 9:02 am 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
Gonna be pretty hard to tell you anything without the HQL statement.

the manual wrote:
Allowable expressions in HQL..."Simple" case, case ... when ... then ... else ... end, and "searched" case, case when ... then ... else ... end


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 11, 2007 1:25 am 
Newbie

Joined: Mon Feb 26, 2007 12:51 am
Posts: 7
Hi Ananasi


Following is my query in SQL, i need to use it as HQL
Please correct the syntax

select b.org_cd,case when b.mgr_alt_id_key_val is null then (select mgr_alt_id_key_val from tuporg where org_id=85713 and del_ind='N')
when b.mgr_alt_id_key_val is not null then (select gv_1_nm from tupprod_alt_id c,tuporg d where c.alt_id_key_value=d.mgr_alt_id_key_val
and d.org_id=85713 and d.del_ind='N' )END AS MGR_ALT_ID_KEY_VAL
from tuporg b where B.org_id=85713 and B.del_ind='N'


Top
 Profile  
 
 Post subject: You might be using SQL functions in the query
PostPosted: Wed Oct 15, 2008 5:01 am 
Newbie

Joined: Fri May 09, 2008 2:21 am
Posts: 1
You usually gets this error if you are trying to use SQL aggregate functions with the HQL

Dont combine SQL with SQL, check your query


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.