SimpleExpression.ignoreCase uses SQL server lowercase function for left part and JAVA
lowercase function for right part of expression
-------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-3464
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3464
Project: Hibernate3
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.6
Environment: tried with PostgreSQL
Reporter: Vitaliy Tymchyshyn
Priority: Minor
When using SimpleExpression.ignoreCase (e.g. Restrictions.eq().ignoreCase, hibernate makes
'lower(field)=?' SQL expression, passing lowercased strings to '?'
parameter. This may produce unpredictable results depending on Database server lower
implementation and current JAVA locale (see JDK javadoc).
For example, I've tried with '\u0130' character as in JDK JavaDoc.
Postgresql produces:
unhappy=> select lower('İ');
lower
-------
i̇
(1 row)
unhappy=> select char_length(lower('İ'));
char_length
-------------
2
(1 row)
While Java with default locale produces single-character 'i̇'. Of course the
restriction will not work - it can not find 'İ' in database.
I'd recommend to use 'lower(field)=lower(?)' to use same lower casing
function for both parts of expression.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira