必须遵循以下代码,如何使用CriteriaBuilder和QueryCriteria更新它?
public Object getNR(String su, String tu, long tst, int nrOfChanges)
throws HibernateException {
Criteria cr = getCurrentSession().createCriteria(MyClass.class);
cr.add(Restrictions.gt("Tst", tst));
Criterion cr1 = Restrictions.and(Restrictions.eq("TU", tu));
Criterion cr2 = Restrictions.and(Restrictions.eq("SU", su))
.add(Restrictions.and(Restrictions.eq("CT", ct)));
cr.add(Restrictions.or(cr1, cr2));
cr.setProjection(Projections.rowCount());
Long nr = (Long) cr.uniqueResult();
return null;
}