java - Is it possible to search for same value on multiple columns with Hibernate Criteria? -
i have search query has many optional parameters , search word field searches many columns. possible use hibernate criteria purpose? need search many columns same search word.
example code (what not working correctly)
if(isnotempty(searchword)) { criteria.add(restrictions.like("description", searchword)); criteria.add(restrictions.like("name", searchword)); }
it looks need or:
criterion description = restrictions.like("description", searchword); criterion name = restrictions.like("name", searchword); logicalexpression orexp = restrictions.or(description, name); criteria.add(orexp);
Comments
Post a Comment