Hibernate version: 3.2.0
Hi experts,
I have to filter a record for multiple values of a column. I have a table say "TBL" and have a field say "f". Now i need to apply a condition
as given below
Code:
select * from TBL where f like 'x' or f like 'y' or f like 'z';
I think i can do it using the following statement:
Code:
criteria.createCriteria(Tbl.class).add(Restrictions.or(Restrictions.ilike("f","x"),Restrictions.or(Restrictions.ilike("f","y"), Restrictions.ilike("f","z"))));
as far as i know the above statement will produce something like:
Code:
select * from TBL where (f like 'x' or (f like 'y' or f like 'z'));
but my problem is, at runtime i know how many values (x, y, z) need to be checked against the property 'f';
How do i do that using Criteria API
thanks in advance