0
I have the following implementation:
private static Specification<Record> sinceMinusMinutes(Integer minutes) {
return (Specification<Record>) (root, query, criteriaBuilder) ->
criteriaBuilder.lessThanOrEqualTo(root.get("Since").as(Timestamp.class), criteriaBuilder.currentTimestamp());
}
However, I would like to subtract 10 minutes from this criteriaBuilder.currentTimestamp(), however, it is an expression, and I can’t even extract the Timestamp from it. There is a way I can subtract from it ?
Ex of what I would like:
private static Specification<Record> sinceMinusMinutes(Integer minutes) {
return (Specification<Record>) (root, query, criteriaBuilder) ->
criteriaBuilder.lessThanOrEqualTo(root.get("Since").as(Timestamp.class), criteriaBuilder.currentTimestamp().minusMinutes(10));
}
NOTE: I would like to use his own time and not a Localdatetime for example.