Restrictions
public class
Restrictions extends
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.
1. in(String,Collection)
public static  in( propertyName,                            values)
Apply an "in" constraint to the named property
Parameters:
propertyName -
values -
Returns:
Criterion
Criteria
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.
      2.
list()
      get all the results.