Caching strategies

One of the most important features of a relational database is support for concurrency and how multiple users can read from and write to the database. This is known as isolation level. The same concept is applicable in ORM cache.

Hibernate has built-in support for various concurrency strategies and isolation levels for a second-level cache. In this section, we will discuss various strategies and when you should use one over the other.

You should keep in mind that Hibernate defines its own isolation level, but a cache provider may offer other levels. When you choose a provider, you should consult the documentation to find out what isolation levels are supported. For example, Ehcache only supports READ-COMMITTED. However, Ehcache ...

Get Mastering Hibernate 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.