hibernate select count
// All entries
Long count = (Long) session.createQuery("select count(ALL YourTable) from YourTable yourTable").getSingleResult();
// filtered entries
Long count = (Long) session.createQuery("select count(yourTable) from YourTable yourTable where yourTable.whatever = whatever").setParameter("whatever", yourParam).getSingleResult();