Где cond1 и (cond2 или cond3)
И
Где (cond1 и cond2) или cond3.
Код спецификации указан ниже:
Код: Выделить всё
Specification updatedAtAndCountGTZeroSpec = new Specification() {
@Override
public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder cb) {
return cb.or(
(cb.and(
cb.lessThanOrEqualTo(root.get("updatedAt"),new Timestamp(now.getTimeInMillis())),
cb.lessThan(root.get("attemptCount"), 3))
),
(cb.equal(root.get("attemptCount"), 0))
);
}
};
where docrecord0_.updated_at < ?
и docrecord0_.attempt_count
Подробнее здесь: https://stackoverflow.com/questions/551 ... arenthesis