When a Hibernate application slows down fetching data across many relationships, the standard fix is to control fetching strategy — favoring lazy loading by default and adding targeted batch or join fetching only where it's actually needed.
An application listing Customers with their Orders was defaulting to EAGER fetching, pulling every order for every customer on a simple list page; switching the association to LAZY and adding @BatchSize(size = 25) cut the query count and page load time dramatically.
A concise interview answer is
I'd start by making sure associations are lazy by default rather than eager, then address the resulting N+1 queries with batch fetching or targeted JOIN FETCH for the specific access patterns that need it, and layer in second-level caching for reference data that rarely changes.
Last updated: 11 November 2026
Previous question: What is optimistic locking in Hibernate?
Next question: How do you handle a Hibernate session in a web application to ensure that it is properly closed, avoiding memory leaks?