Limit findAll possible with Spring?

前端 未结 3 653
名媛妹妹
名媛妹妹 2021-02-07 16:18

Is it possible with Springs auto implemented repositories to limit the result size of the findAll method?

I\'m trying to have something like the following declared in th

3条回答
  •  独厮守ぢ
    2021-02-07 16:40

    You need to explicitly specify the ordering, otherwise Spring Data JPA has no way of deciding what criteria it should use. For instance:

    List findAllTopTenByAge();
    

    See more details in the official documentation.

提交回复
热议问题