Hibernate Max method: calculate the maximum value of a column

max(String propertyName)

Example

Criteria criteria = session.createCriteria(ResultForm.class);  //获取Criteria对象
criteria.setProjection(Projections.max("achievement"));  //获取achievement列的最大值
double max = (Double)criteria.uniqueResult();  //获取查询结果
System.out.println("最高成绩:"+max);
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>