The largest Interview Solution Library on the web

Hibernate Tutorials/
« Previous | 1 | 2 | 3 | Next »
The Criteria API provides the org.hibernate.criterion.Projections class which can be used to get average, maximum or minimum of the property values. The Projections class is similar to the Restrictions class in that it provides several static factory methods for obtaining Projection instances.
Following are the few examples covering different scenarios and can be used as per requirement:

Criteria cr =session.createCriteria(Employee.class);

// To get total row count.

// To get average of a property.

// To get distinct count of a property.

// To get maximum of a property.

// To get minimum of a property.

// To get sum of a property.
« Previous | 1 | 2 | 3 | Next »

copyright © 2014 - all rights riserved by