Select MAX timestamp with JPA2 Criteria API

Instead of max one should use CriteriaBuilder.greatest for Timestamp (and for Date, String and other Comparables as well). And if you ever need MIN for Timestamp, then use least method instead

Similar kind of issue can be be faced with less/greater/equal comparisons. Firs one accepts argument that extends Number, second one is for other comparables:

  • lt vs. lessThan
  • le vs. lessThanOrEqualTo
  • ge vs. greaterThanOrEqualTo
  • gt vs. greaterThan

Leave a Comment

techhipbettruvabetnorabahisbahis forumu