Select MAX timestamp with JPA2 Criteria API
问题 So my entity has: @Column(name="TS", nullable=false) private java.sql.Timestamp timestamp; My generated MetaModel has: public static volatile SingularAttribute<MyEntity,Timestamp> timestamp; I want to select by the Max Timestamp value: Root<MyEntity> root = query.from(MyEntity.class); Expression maxExpression = cb.max(root.get(MyEntity_.timestamp)); But I am not allowed because: max(Expression<N> x) Create an aggregate expression applying the numerical max operation. <N extends java.lang