I ran across a minor code smell in Hibernate when dealing with case-insensitive like.  The offending class is ILikeExpression:
 
  if ( dialect instanceof PostgreSQLDialect ) {
   return columns[0] + " ilike ?";
  }
  else {
   return dialect.getLowercaseFunction() + '(' + columns[0] + ") like ?";
  }
 
This might be better and more OO:
 
  String ilikeOperator = dialect.getILikeOperator();
  if ( ilikeOperator != null ) {
   return columns[0] + " " + ilikeOperator + " ?";
  }
  else if ( dialect.areStringComparisonsCaseInsensitive() ) {
   return columns[0] + " like ?";
  }
  else {
   return dialect.getLowercaseFunction() + '(' + columns[0] + ") like ?";
  }
 
PostgresSQLDialect.getILikeOperator() would return "ilike".  All other dialects would return null.