【发布时间】:2021-12-22 04:16:40
【问题描述】:
由于spring的@query不支持限制,我们需要分页查询参数以外的其他方法
【问题讨论】:
标签: spring spring-data-jpa hql
由于spring的@query不支持限制,我们需要分页查询参数以外的其他方法
【问题讨论】:
标签: spring spring-data-jpa hql
@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();
【讨论】:
@Query(" select something s where s.id = select max(so.id) something so order by so.id desc")
optionam<something> findlatestSomething();
【讨论】: