InterviewSolution
| 1. |
Explain Criteria Api? |
|
Answer» 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. Example : List employees = session.createCriteria(Employee.class) .add(Restrictions.like("name", "a%") ) .add(Restrictions.like("address", "Boston")) .addOrder(Order.asc("name") ) .list(); 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. Example : List employees = session.createCriteria(Employee.class) .add(Restrictions.like("name", "a%") ) .add(Restrictions.like("address", "Boston")) .addOrder(Order.asc("name") ) .list(); |
|