-->
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.  [ 5 posts ] 
Author Message
 Post subject: Select if(Statements)
PostPosted: Fri Dec 02, 2005 2:28 am 
Newbie

Joined: Fri Dec 02, 2005 2:21 am
Posts: 3
Dear Hibernate Experts!!
I am having a select query to process using hibernate...The following is the syntax
"
private static final String MYQUERY = "select (if FP.fatherid=0,FP.pid,FP.msid) as msid, FP.level "+
"from Parts FP, Parts P "+
"where P.fatherid=FP.pid and P.pid=?";

List msidList = getHibernateTemplate().find(MYQUERY ,pid);

and following is the error message which I get in Tomcat
java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.Me
thodNode
+-[METHOD_CALL] MethodNode: '('
| +-[METHOD_NAME] IdentNode: 'if' {originalText=if}
| \-[EXPR_LIST] SqlNode: 'exprList'

Please help

HKG


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 02, 2005 7:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
i think you are looking for a CASE statement.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 02, 2005 8:14 am 
Newbie

Joined: Wed Nov 17, 2004 11:47 am
Posts: 3
Location: Kharkov, Ukraine
Incorrect HQL statement.
See HQL BNF notation - http://hibernate.org/89.html

Hibernate wiki can be helpful - http://hibernate.org/37.html

_________________
Best regards, Yuriy


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 02, 2005 9:02 am 
Newbie

Joined: Fri Dec 02, 2005 2:21 am
Posts: 3
Yes I am looking for a CASE Statement. But the above said query is working with MySQL
[quote="steve"]i think you are looking for a CASE statement.[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 02, 2005 11:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Yes, well Hibernate is not MySQL now is it?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.