This clause lets Hibernate pull information from the database and group it based on a value of an attribute and, typically, use the result to include an aggregate value. Following is the simple syntax of using GROUP BY clause:
String hql ="SELECT SUM(E.salary), E.firtName FROM Employee E "+
"GROUP BY E.firstName"; Query query =session.createQuery(hql); List results =query.list(); |