Jpa pagination suppress count query

We use the JPA Spring data repository. For pagination, we pass the Pageable to the JPA Repository findBy search methods.

Since we do not show the total number of records in our user interface, we do not want the count request to be fired. Is there a way to suppress the counter request launched during pagination?

+6
source share
1 answer

Restore the List<Entity> repository method, not Page<Entity> , and I believe that it will not trigger the count request.

See "Custom Parameter Processing" in the Spring JPA Documentation section of the "1.2.2 Defining Query Methods" section .

+6
source

Source: https://habr.com/ru/post/957525/


All Articles