-->
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.  [ 3 posts ] 
Author Message
 Post subject: query: case insensitive for mySQL ?
PostPosted: Wed Mar 16, 2005 11:09 am 
Regular
Regular

Joined: Tue Jul 13, 2004 2:27 am
Posts: 73
Location: Singapore
Hibernate version:
2.1.6

Name and version of the database you are using:
MySQL 4.0.18


Hi,
I would like to confirm if it is true that for my particular configuration the query is case insensitive - though what I have read so far seems that query should be case sensitive.

I am using Spring framework together with Hibernate, here is the code:

...
private static final String countUserQuery = "select count(*) from User u where u.username=?";

...
int count = ((Integer) getHibernateTemplate().find(countUserQuery, user.getUsername()).iterator().next()).intValue();

In the database, I have a user with name 'Alex'. When I set user name to 'alex', it always return 1.

What's wrong here ? I thought query should be case InSensitive ....

thanks for your help,
li xin


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 16, 2005 11:54 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
for mysql, all sql queries are case insensitive, as far as i know - read the mysql manual


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 16, 2005 10:34 pm 
Regular
Regular

Joined: Tue Jul 13, 2004 2:27 am
Posts: 73
Location: Singapore
thanks !

checked and I can use something like:

from User user where binary user.name = ?

for case sensitive query.


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