-->
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.  [ 2 posts ] 
Author Message
 Post subject: HQL in(..) operator and upper(..) function
PostPosted: Tue Apr 25, 2006 7:12 am 
Newbie

Joined: Fri Apr 14, 2006 9:37 am
Posts: 5
Hi, i'm trying to combine the in(..) operator and the upper(..) function with no success.
My starting point is the following HQL query, which works correctly:
Code:
Query q = session.createQuery("from Worker w where w.workType in (:param)");
q.setParameterList("param", new String[] { "Director", "Actor"});


Without transforming to upper case the string array, i would like to combine the in(..) operator with the upper(..) operator, for performing a case insensitive search of "director", "DIRECTOR", "Director", etc... but it doesn't work:
Code:
Query q = session.createQuery("from Worker w where upper(w.workType) in (upper(:param))");
q.setParameterList("param", new String[] { "Director", "Actor"});


The resulting SQL query is not correct, because the in clause is expanded into
Code:
in (upper(?, ?))


Is there a way to modify the HQL query for it to work, without changing the input string array ?

Thanks


Top
 Profile  
 
 Post subject: u r passing two parameters in that that is the wrong u r doi
PostPosted: Tue Apr 25, 2006 7:41 am 
Beginner
Beginner

Joined: Mon Mar 27, 2006 5:25 am
Posts: 39
Location: India Hyderabad
Hi Friend,

You are using upper function in the query.
But upper function wil take only one parameter at a time
but u r passing two parameters in that that is the wrong u r doing

regards
vinny


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