I use spring boot with spring data jdbc.
I search to get x number of record
In a interface I have
@Query("select u from user where status=1");
List<User> findUser();
Is it possible in spring data jdbc?
I use spring boot with spring data jdbc.
I search to get x number of record
In a interface I have
@Query("select u from user where status=1");
List<User> findUser();
Is it possible in spring data jdbc?
There is currently no build in mechanism to do that, so you can't just add a Pageable
as an argument to achieve this.
But you can incorporate the limit in the query. Note that the syntax varies between databases. The following example should work for MySql
@Query("select u from user where status=1 ORDER BY u LIMIT :rows)
List<User> findUser(int rows);