title: Difference between Restrictions.like and .ilike in Hibernate Criteria API
body: <p>Hibernate's <code>Criteria</code> API has <code>Restrictions.ilike</code> function which has the following contract:</p>
  
  <blockquote>
    <p>A case-insensitive "like", similar to Postgres ilike operator</p>
  </blockquote>
  
  <p>That's cool. But the same class also has <code>like</code> function, having much more vague contract:</p>
  
  <blockquote>
    <p>Apply a "like" constraint to the named property</p>
  </blockquote>
  
  <p>example</p>
  
  <pre><code>Criteria cr = session.createCriteria(Employee.class);
  
  // To get records having fistName starting with zara
  cr.add(Restrictions.like("firstName", "zara%"));
  
  // Case sensitive form of the above restriction.
  cr.add(Restrictions.ilike("firstName", "zara%"));
  </code></pre>