-->
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: Criteria result set with upper case values
PostPosted: Mon Feb 23, 2009 3:47 pm 
Newbie

Joined: Tue Oct 07, 2008 12:17 pm
Posts: 13
Hi all,
I've a problem with the result sets using criteria api. The result set to be upper cased by the criteria list().

SQL query:
select empid, upper(name), dept from employee where empid=1;

The above query returns the result with the upper case name column.
But the below query returns the exact name values from the table.

Criteria query:
Criteria criteria = session.createCriteria(Employee.class);
List list = criteria.add(Restrictions.ilike("empid", empid)).list();

I appreciate if any one clarify how to resolve this issue.

Thanks
Velu


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 24, 2009 7:38 am 
Beginner
Beginner

Joined: Wed Nov 19, 2008 6:39 am
Posts: 44
Location: Mumbai, India
If you want the name in uppercase then use toUpperCase() function

Thx,
Murugesan.

_________________
Thx,
Murugesan.
Web: http://www.murugesanpitchandi.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 24, 2009 5:32 pm 
Newbie

Joined: Tue Oct 07, 2008 12:17 pm
Posts: 13
Thanks for your reply murugesan.
I found another solution as we can make the Hibernate to deal with upper case of the result set by defining below in mapping file.

<property name="name" column="NAME" formula="upper(NAME)" />

Thanks
Velu


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2009 4:41 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
Yes, thats a solution. But in that case your name will always be in uppercase. Is that wanted?

_________________
-----------------
Need advanced help? http://www.viada.eu


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2009 8:51 pm 
Newbie

Joined: Tue Oct 07, 2008 12:17 pm
Posts: 13
Yes.. I wanted the result set should return the name field upper cased.


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.