How to query data out of the box using Spring data JPA by both Sort and Pageable?

后端 未结 6 1647
别那么骄傲
别那么骄傲 2020-12-12 12:50

I am trying Spring data JPA in my project. I want to know if there is an out-of-the-box API to query data, by both Sort and Pageable. Of course, I

6条回答
  •  [愿得一人]
    2020-12-12 13:24

    Pageable has an option to specify sort as well. From the java doc

    PageRequest(int page, int size, Sort.Direction direction, String... properties) 
    

    Creates a new PageRequest with sort parameters applied.

提交回复
热议问题