i'd like to select items case insensitive with an In-Criterion with Hibernate Criteria API. E.g.
Criteria crit = session.createCriteria(Item.class);
crit.add(Restrictions.in("prop", valueList).ignoreCase());
Unfortunately the Criterion class doesn't has an ignoreCase method. HQL is not an alternative.
Get the source code of the Criterion class returned by Restrictions.in()
(InExpression
), and create another one which is similar but transforms all the elements of the value list to lowercase, and generates a SQL query like:
lower(prop) in (...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With