hibernate查询记录总数量
String hql = "select count(*) from Presc p " + "where p.operType = ? and (trunc(p.orderDate) between ? and ?)";Query query = getSession().createQuery(hql);query.setString(0, prescTypeCode);query.setDate(1, startDate);query.setDate(2, endDate);Integer count = (Integer) query.uniqueResult();