Get record with max id, using Hibernate Criteria

后端 未结 8 1697
后悔当初
后悔当初 2020-12-15 16:18

Using Hibernate\'s Criteria API, I want to select the record within a table with the maximum value for a given column.

I tried to use Projections, creating an alias

8条回答
  •  情歌与酒
    2020-12-15 16:58

    For the max() function in hibernate:

    criteria.setProjection(Projections.max("e.encounterId"));
    

提交回复
热议问题