Suppose I have a table Person and i want to count all those people whose \"birthDate\" is not null and they are a student.
Assuming i have two columns :
Number count = (Number) session.createQuery(
"select count(p.id) from Person p"
+ " where p.birthDate is not null and p.isStudent = true").uniqueResult();