davout_uk wrote:
I have a Criteria based query where the code will require multiple 'or' type restrictions. Yet the 'Restriction.or()' function only allows two parameters. How would you construct a Criteria query that had 5 different restrictions that are to be joined by 'or'?
You can use :
Code:
Criteria crit = session.createCriteria(Survey.class);
Criterion address = Restrictions.like("address", "Jln. Ketapang", MatchMode.ANYWHERE);
Criterion firstName = Restrictions.eq("name", "Agus");
Disjunction disjunction = Restrictions.disjunction();
disjunction.add(address);
disjunction.add(firstName);
crit.add(disjunction);