this( propertyName, matchMode.toMatchString(value) );
}
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
Dialect dialect = criteriaQuery.getFactory().getDialect();
String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
if (columns.length!=1) throw new HibernateException("ilike may only be used with single-column properties");
if ( dialect instanceof PostgreSQLDialect ) {
return columns[0] + " ilike ?";
}
else {
return dialect.getLowercaseFunction() + '(' + columns[0] + ") like ?";
}
//TODO: get SQL rendering out of this package!
}