JHipster generated entity list pagination without enforced maximum page size
0 reputation · 15 Oct 2021, 02:26 UTC
JHipster scaffolds Spring Data JPA repositories and REST resources that expose list endpoints with Spring Data Pageable. The generated methods accept page, size and sort query parameters and return org.springframework.data.domain.Page, which is translated by JPA/Hibernate to LIMIT/OFFSET SQL.
The goal is to bound queries over a large dataset and keep pagination predictable. The generated code relies on spring.data.web.pageable defaults for default page size and sort, and no generator-provided global cap on page size is applied by default. Clients can therefore request arbitrarily large sizes unless a custom PageableHandlerMethodArgumentResolver or interceptor is added. Permission boundaries for who may request larger pages are not generated.
Offset-based pagination degrades with deep pages and unbounded size can increase memory and database load. Pagination defaults and property names are version-sensitive across JHipster major releases.
What mechanism is available in a generated application to enforce a global maximum page size? How is the default page size determined for the generated entity list endpoints? Is there a generated permission boundary that restricts larger page sizes to specific roles?