Case-insensitive equals using Hibernate Criteria

后端 未结 7 1495
旧时难觅i
旧时难觅i 2021-01-31 13:32

I\'ve seen Restrictions.ilike(\'property\', \'%value%\'), but would like to generate SQL like: lower(property) = \'value\'. Any ideas?

I used:

Restri         


        
7条回答
  •  终归单人心
    2021-01-31 14:23

    I'm not absolutely sure, but when you use Restriction.eq you obtain a SimpleExpression object, and that object suppports an ignoreCase() operation which I've never tried using but sounds like it could make a difference.

    Kudos to Hibernate for not documenting what this method actually does.

提交回复
热议问题