- public class Restrictions
- extends Object
The criterion package may be used by applications as a framework for building new kinds of Criterion. However, it is intended that most applications will simply use the built-in criterion types via the static factory methods of this class.
public static Criterion in(String propertyName, Collection values)
- Apply an "in" constraint to the named property
- Criteria is a simplified API for retrieving entities by composing
Criterion objects. This is a very convenient approach for functionality
like "search" screens where there is a variable number of conditions to be
placed upon the result set.
- The Session is a factory for Criteria. Criterion instances are usually obtained via the factory methods on Restrictions. eg.
- List cats = session.createCriteria(Cat.class) .add( Restrictions.like("name", "Iz%") ) .add( Restrictions.gt( "weight", new Float(minWeight) ) ) .addOrder( Order.asc("age") ) .list();
- 1. add(Criterion)
- Add a Criterion to constrain the results to be retrieved.
get all the results.