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

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -