-->
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: Problem with the function DECODE in Oracle
PostPosted: Wed Apr 14, 2004 10:17 am 
Newbie

Joined: Thu Feb 26, 2004 10:15 am
Posts: 7
Hi guys,
I have to execute a complexe SQL Request on Oracle DataBase.
My request uses an Oracle function like this :

SUM(DECODE(table.field,value,1,0)

The problem is that when I try to execute this request through Hibernate
I get the following exception :

net.sf.hibernate.QueryException: undefined alias: decode [.....

Obviously Hibernate does not understand the DECODE function.

How could I make it understand this function ?

Is there any place, for example the mapping.xml file
where I could specify to Hibernate to ignore the DECODE function ?

Any idea about this issue ?

moh.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 15, 2004 7:04 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You can add it to the OracleDialect class.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 15, 2004 8:03 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I don't think you can, AFAIK only one- or zero-Argument functions are yet supported in the select clause of HQL (and you can only add those to the dialect). So currently I don't think there is a way to use multiple-argument functions in the select clause.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 15, 2004 9:05 am 
Newbie

Joined: Fri Oct 31, 2003 9:17 am
Posts: 10
Location: USA
Hi,

Is it possible to use createSQLQuery()? I'd try it myself, but I do not have Oracle on my machine.

hope this helps


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.