因为在spring的@query中不支持limit,所以我们需要使用除分页查询参数之外的其他方法
发布于 2021-11-09 12:52:41
@Query(" select something so where so.id>50 order by so.created desc")
@QueryHints(@QueryHint(name = "org.hibernate.annotations.FETCH_SIZE" , value = "1"))
optionam<something> findlatestSomething();发布于 2021-11-11 06:51:57
@Query(" select something s where s.id = select max(so.id) something so order by so.id desc")
optionam<something> findlatestSomething();https://stackoverflow.com/questions/69898469
复制相似问题