package net.roseindia.action;

import java.util.List;
import net.roseindia.bean.StudentBean;
import net.roseindia.util.HibernateUtil;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Projections;

public class CriteiaSort {
	public static void main(String[] args) {
		Session session = HibernateUtil.getSessionFactory().openSession();
		Criteria criteria = session.createCriteria(StudentBean.class);
		criteria.setProjection(Projections.avg("fee"));
		List totalFee = criteria.list();
		System.out.println("Average value of fee column : " + totalFee);
	}
}
