code: public Number getTotalCount(Criterion... criterion) throws HibernateException {
          Criteria criteria = getSession().createCriteria(entityClass);
          addCriterionsToCriteria(criteria, criterion);
          criteria.setProjection(Projections.rowCount());
          return (Long) criteria.uniqueResult();
      }
docs: Returns the total count of db entries for the current type.
  
  @param criterion
  @return