Spring Data JPA apply sorting, pagination along with a where clause

前端 未结 3 1475
春和景丽
春和景丽 2021-02-04 06:35

I am currently Using Spring JPA and utilizing the Sorting and Pagination as described here -

How to query data via Spring data JPA by sort and pageable both out of box?<

3条回答
  •  孤街浪徒
    2021-02-04 07:19

    Just create a query method in your repository interface for this.

    Take a look in the docs, here.

    Add a query method with paging and where clause.

    Page findByLastname(String lastname, Pageable pageable);
    

    So you can find User by a property "lastname" and configure Paging settings.

提交回复
热议问题