CHAPTER 12
Caching in Hibernate
Caching is one of the important features implemented by an application for better performance. From an ORM perspective, data retrieved from a database is cached in memory or to disk, so there is no need to make a call to the database for every request. A cache is a local copy of the information from the database that can be used to avoid a database call whenever the following situations occur:
- The application performs a lookup by identifier
- The persistence layer resolves an association or collection lazily
In Figure 12-1, when an application queries for data the first time, Hibernate fetches it from the database; ...
Get Hibernate Recipes: A Problem-Solution Approach, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.