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 :
int result= (int)((long)session.createQuery("select count(p) from User p where p.mobileNumber = :pMobileNumber")
.setParameter("pMobileNumber", mobileNumber).uniqueResult());