hibernate标准限制和/或组合
我将如何实现这个使用hibernate限制?
(((A='X') and (B in('X',Y))) or ((A='Y') and (B='Z')))
思考的作品
Criteria criteria = getSession().createCriteria(clazz); Criterion rest1= Restrictions.and(Restrictions.eq(A, "X"), Restrictions.in("B", Arrays.asList("X",Y))); Criterion rest2= Restrictions.and(Restrictions.eq(A, "Y"), Restrictions.eq(B, "Z")); criteria.add(Restrictions.or(rest1, rest2));