Introduction In this article, we are going to see how we can use the JOIN FETCH clause when fetching a child collection eagerly while also limiting the number of parent records using pagination in a Spring Data JPA application. I decided to write this article because the most common solution used in many projects turns out to be extremely inefficient. Domain Model Let’s assume we have a parent Post entity that has a one-to-many relationship with the child PostComment entity. The Post parent entity is mapped as follows: And the PostComment child... Read More
The post The best way to use JOIN FETCH and Pagination with Spring appeared first on Vlad Mihalcea.