I'm trying to fetch the count of all individual records from mysql database using hibernate and I have to store it in a map collection. How to do this?
try {
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
session = sessionFactory.openSession();
tx = session.beginTransaction();
String hql = "select attendencestatus ,COUNT(attendencestatus) from studentattendance group by attendencestatus ";
Query query = session.createQuery(hql);
tx.commit();
} catch (HibernateException he) {
he.printStackTrace();
tx.rollback();
}