有关Restrictions.or和Restrictions.and的小问题
如果我做这样的事情:
...
criterion = criterionA;
criterion = Restrictions.and(criterion, criterionB);
criterion = Restrictions.or(criterion, criterionC);
criterion = Restrictions.and(criterion, criterionD);
这将被视为:
(A and B) or (C and D) (following mathematical conventions)
或将按照添加限制的顺序对其进行处理:
(((A and B) or C) and D)
如果有的话,还请添加参考...
应该将其视为后者
(((A and B) or C) and D)
你可以做
criterion = Restriction.or(Restrictions.and(criterionA, criterionB), Restrictions.and(criterionC, criterionD))
如果您想要第一个解决方案
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句