0

I am trying to find rows that has one of the values I am looking for in one of the 2 columns. So far I've used a criteria like this but it doesn't find anything.

Criterion a = Restrictions.in("oid", workOrderOids);

Criterion b = Restrictions.in("parentReworkOid", workOrderOids);

Criterion c = Restrictions.or(a, b);

What might i be doing wrong?

Ramesh
  • 1,872
  • 2
  • 20
  • 33

1 Answers1

0

You can try using disjunction here.

Criteria crit = session.createCriteria(YourClass.class);
Disjunction disjunction = Restrictions.disjunction();
disjunction.add(Restrictions.in("oid", workOrderOids));
disjunction.add(Restrictions.in("parentReworkOid", workOrderOids));
// add others if any
crit.add(disjunction);
Pramod Karandikar
  • 5,289
  • 7
  • 43
  • 68
  • Thanks I found the main source of the problem. It was happening because there were null values in one of my columns so "in" clause was returning true all the time. – Umut Uzgur Feb 09 '15 at 09:17