-->
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: upper() function in hql on column name and bind param value
PostPosted: Mon Oct 01, 2007 5:50 am 
Newbie

Joined: Fri Apr 13, 2007 10:58 am
Posts: 10
Hello,

I have a one question to ask about using the upper() function in HQL.
I have a hql like this:

from SampleModel where upper(lastName)=upper(:lastName)

When i try to execute this query, i get the exception as mentioned in debug level hibernate log at the bottom of this post.

Is the above hql not a valid one??

I executed the following on the DB2 console :

SELECT * FROM ADMINISTRATOR.SAMPLE_TABLE where upper(last_name)=upper('Gohel');

and i am getting proper result.

And the generated SQL as mentioned below is similar.

So can anybody please help explaining me the reason behind the exception occuring??


Hibernate version: hibernate 3.0.3

Database name : IBM DB2 version 8.0

Generated SQL :
select samplemode0_.sample_table_id as sample1_0_, samplemode0_.first_name as first2_0_, samplemode0_.last_name as last3_0_ from administrator.sample_table samplemode0_ where upper(samplemode0_.last_name)=upper(?)



Debug level hibernate log:
15:05:25,671 WARN JDBCExceptionReporter:77 - SQL Error: -418, SQLState: 42610
15:05:25,671 ERROR JDBCExceptionReporter:78 - DB2 SQL error: SQLCODE: -418, SQLSTATE: 42610, SQLERRMC: null
15:05:25,671 WARN JDBCExceptionReporter:77 - SQL Error: -727, SQLState: 56098
15:05:25,687 ERROR JDBCExceptionReporter:78 - DB2 SQL error: SQLCODE: -727, SQLSTATE: 56098, SQLERRMC: 2;-418;42610;
15:05:25,687 WARN JDBCExceptionReporter:77 - SQL Error: -727, SQLState: 56098
15:05:25,687 ERROR JDBCExceptionReporter:78 - DB2 SQL error: SQLCODE: -727, SQLSTATE: 56098, SQLERRMC: 2;-418;42610;
HibernateException occured.Details are as follows : could not execute query




Thanks,
Jignesh


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 01, 2007 7:28 am 
Newbie

Joined: Tue Nov 28, 2006 4:34 am
Posts: 5
Maybe this way:
Code:
from SampleModel sm where upper(lastName)=upper(:lastName)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 05, 2007 8:24 am 
Newbie

Joined: Fri Apr 13, 2007 10:58 am
Posts: 10
No, the query mentioned above also is not working.
Can anybody please let me know, if it can be done, and if yes, then how?

Thanks,
Jignesh


Top
 Profile  
 
 Post subject: Re: upper() function in hql on column name and bind param value
PostPosted: Thu Nov 05, 2009 7:53 am 
Beginner
Beginner

Joined: Wed Jul 09, 2008 5:34 am
Posts: 41
Location: Brno, Czech Republic
https://jira.jboss.org/jira/browse/JBPAPP-3056


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.