在春季数据 JPA 中创建分页
2022-09-03 08:25:32
我正在尝试在Spring Data JPA中实现分页功能。我指的是这个博客我的控制器包含以下代码:
@RequestMapping(value="/organizationData", method = RequestMethod.GET)
public String list(Pageable pageable, Model model){
Page<Organization> members = this.OrganizationRepository.findAll(pageable);
model.addAttribute("members", members.getContent());
float nrOfPages = members.getTotalPages();
model.addAttribute("maxPages", nrOfPages);
return "members/list";
}
我的 DAO 如下:
@Query(value="select m from Member m", countQuery="select count(m) from Member m")
Page<Organization> findMembers(Pageable pageable);
我能够显示前20条记录,我如何显示下一个20条记录???我还可以参考任何其他分页示例吗?