Hibernate caching

To improve the performance of your application, Hibernate uses a cache (second level cache) which can be used for both entities and remote queries. By default, all caches are enabled for the entities. For all generated queries they have to be enabled manually.

Architecture overview

image not found

  • First Level Cache: Actual object level, related to the user session, since each user keeps its own objects in memory after a query.

  • Second Level Cache: Actual cache, provides caching for all user sessions.

  • JDBC: Writes and reads data from the database

  • Database: Keeps the data persistent (persistence level).