What is second level cache in hibernate?

paku picture paku · May 13, 2010 · Viewed 7.4k times · Source

What is second level cache in hibernate ?

Answer

Pascal Thivent picture Pascal Thivent · May 13, 2010

Hibernate comes with three different caches: first level, second level and query cache.

The first level cache is the Hibernate Session and is used to track the state of entities during the current Session (or unit of work). This is a transaction-level cache.

The second level cache shares entity state across various Session. This is a SessionFactory-level cache.

The query cache is used to cache queries (and their parameters) and their results.

Recommended readings