How can you remove a criterion from criteria?
Posted
by ChuckM
on Stack Overflow
See other posts from Stack Overflow
or by ChuckM
Published on 2010-03-12T15:55:54Z
Indexed on
2010/03/12
16:57 UTC
Read the original article
Hit count: 279
Hello,
For instance if I do something like:
Criteria c = session.createCriteria(Book.class)
.add(Expression.ge("release",reDate);
.add(Expression.ge("price",price);
.addOrder( Order.asc("date") )
.setFirstResult(0)
.setMaxResults(10);
c.list();
How can I use the same criteria instance, but remove (for example) the second criterion? I'm trying to build a dynamic query in which I'd like to let the user remove a filter, without the backend having to reconstruct the criteria from scratch.
Thank you
© Stack Overflow or respective owner