|
Example:
Criteria criteria = session.createCriteria(Entity.class);
criteria.add(Restrictions.eq("someField", someValue).ignoreCase());
return criteria.list();
The above code does not work on Nationalized (NVARCHAR/NCHAR) fields.
After investigating, it appears SimpleExpression checks the column data type during an ignoreCase=true scenario and will only apply the SQL dialect specific lower function to the left-hand side of the equation when the column data type is either VARCHAR or CHAR.
In the case of NVARCHAR and NCHAR fields, the left-hand side of the equality SQL fragment is not wrapped by the SQL dialect lower function, but because the right-hand side value is lowered, the database comparisons fail and yield no results when using NVARCHAR/NCHAR types.
|