The SimpleExpression class has an "ignoreCase" method on it, which can return you a version of a SimpleExpression which is case insensitive, and should generate some SQL like (assuming the value
is lowercased in code)
lower(COLUMN) = 'value'
However, that ability does not exist on other expression types,
which would seem to make sense to have it:
Property Expressions (=,<,>,<=,>=)
I've worked around it by creating my own Criterion implementations which essentially wrap the existing ones, and does a string replacement on the generated SQL to replace the column name with
lower(COLUMN_NAME). I'm using hibernate to determine what the
appropriate function for lower is, given the session's dialect.
I've tried to use the lower function in the property name, but that
does not work either. However, it would be nice to have this feature built into hibernate. As a side note, it would also be nice to be able to have something other than a property name on the lhs, so that someone could evaluate functions and expressions. IE:
prop1 + prop2 < 10
is not possible now unless you use hql directly.