Sql server Hibernate查询与国际字符
我在JavaSE应用程序中使用hibernate从数据库中查询一些数据。但我需要在where子句中使用波兰语字符,例如:Sql server Hibernate查询与国际字符,sql-server,hibernate,encoding,internationalization,Sql Server,Hibernate,Encoding,Internationalization,我在JavaSE应用程序中使用hibernate从数据库中查询一些数据。但我需要在where子句中使用波兰语字符,例如: where province='MAŁOPOLSKA' 但结果集为空。 使用SQL Server时,我只需要在'Małopolska'字符串前添加N个字母。 我试图找到一个解决方案,我唯一找到的就是把这些行放到配置文件中 <property name="hibernate.connection.CharSet">UTF-8</property> &
where province='MAŁOPOLSKA'
但结果集为空。
使用SQL Server时,我只需要在'Małopolska'字符串前添加N个字母。
我试图找到一个解决方案,我唯一找到的就是把这些行放到配置文件中
<property name="hibernate.connection.CharSet">UTF-8</property>
<property name="hibernate.connection.characterEncoding">UTF-8</property>
<property name="hibernate.connection.useUnicode">true</property>
UTF-8
UTF-8
符合事实的
但它不会改变任何东西,即我得到的结果集是空的
如有任何提示,将不胜感激。已解决。
我用参数替换了普通的'MAŁOPOLSKA'字符串,效果很好。例如:
where province = :provName
q.setParameter("provName", 'MAŁOPOLSKA');