Hi,
i tried your code against mysql
query looks fine to me and lower() is working fine
but database(atleast mysql) by default is performing case in sensitive compariosion for string values.
see below code
Code:
String[] cities={"pune","delhi","mumbai","CHENNAI"};
List<String> adressCities=ses2.createQuery("select a.city from AddressEntity a where lower(a.city) IN (:cities)").setParameterList("cities",cities).list();
System.out.println("no of address ="+adressCities.size()+"::"+adressCities);
and values for city filed in DB are
MUMBAI
CHENNAI
DELHI
pune
this query select all the 4 values, instead it should have selected only first 3 except CHENNAI
no of address =4::[MUMBAI, CHENNAI, DELHI, pune]
and lower is working fine .as you can see from below
Code:
String[] cities={"pune","delhi","mumbai","CHENNAI"};
List<String> adressCities=ses2.createQuery("select lower
(a.city) from AddressEntity a where lower(a.city) IN (:cities)").setParameterList("cities",cities).list();
System.out.println("no of address ="+adressCities.size()+"::"+adressCities);
this gives output as below when lower is with selected values
no of address =4::[mumbai, chennai, delhi, pune]
the issue is because of case insesitive comparision by DB
if you are tring to leave out upper case values(or other way around) from selection see below
links
http://www.mysqlfaqs.net/mysql-faqs/SQL-Statements/How-to-manage-case-sensitivity-in-string-comparisons[url]
http://dev.mysql.com/doc/refman/5.0/en/ ... ivity.html[/url]
HTH
narayan