views:

2218

answers:

1

I have a DetachedCriteria which I am using to search a table based on a name field. I want to make the search case-insensitive, and am wondering if there is a way to do this without using HQL. Something like:

private void searchByFullName(DetachedCriteria criteria, String searchCriteria) {
 criteria.add(Restrictions.like("fullName", "%" + searchCriteria.toUpperCase() + "%"));
 criteria.addOrder(Order.asc("fullName"));
}

But I want to make sure that it will ignore the case when it does the search, so the SQL it generates should look something like:

SELECT * FROM PEOPLE WHERE ? LIKE toUpper(FULL_NAME);