I have MySQL InnoDB table utf-8 encoded. This table has only id and name field. Names are in russian language and 1 name in English for testing purpose. English name selects ok but when trying to select with russian name it returns empty list. I tried to build queries both with Criterion and HQL.
getHibernateTemplate().find("from FirstName where name='free' ");
getHibernateTemplate().find("from FirstName where name='ИННА' ");
Here is connection string –
?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf8
i’m using hibernate 3.2.7.ga and spring 2.5.6.SEC03
Here is hibernate log:
Hibernate: /* from FirstName where name='ИННА' */ select firstname0_.`id` as id1_24_, firstname0_.`name` as name2_24_ from `first_name` firstname0_ where firstname0_.`name`='ИННА' limit ?
Thanks to all, i have found an answer.
The problem was in connection string.
I did refactor and moved connection string to the properties file instead of xml with spring-bean. But i did not changed “
&” entity to the “&”.Successfull connection string is in properties file
XML file changes
&entities to the correct, but properties format don’t do this.