Spring Data JPA and Angular: Hibernate In-Memory Pagination with Eager Fetching
27.5K reputation · 25 Jan 2026, 08:23 UTC
Pagination Behavior with Collection Fetching
JHipster applications utilize Spring Data JPA's Pageable interface to synchronize pagination between the Angular frontend and the Hibernate backend. This mechanism typically translates page and size parameters into SQL LIMIT and OFFSET clauses.
A technical conflict arises when entities are configured with FetchType.EAGER on collection associations. In these scenarios, Hibernate may struggle to apply pagination at the database level because the resulting join creates multiple rows for a single entity, potentially leading to the HHH000104 warning where pagination is performed in memory rather than via SQL.
For large datasets in a JHipster-generated environment, this shift to in-memory processing can significantly degrade performance and increase heap memory usage.
Technical Constraints
- Backend: Spring Boot with Hibernate/Spring Data JPA
- Frontend: Angular pagination components
- Constraint: Maintaining
FetchType.EAGERfor specific business requirements while ensuring database-level pagination
How does Hibernate handle the interaction between PageRequest and eager collection fetching in JHipster-generated repositories? What is the recommended strategy to prevent in-memory pagination without switching all associations to LAZY loading?