hql如何查询总数

Query query = session.createQuery(hql);  

num = (new Integer(query.uniqueResult().toString()))   .intValue();