Describe the Second Level Cache in Hibernate.

The second-level cache is an optional, SessionFactory-scoped cache in Hibernate that stores entity data across multiple sessions, so repeated lookups of the same data don't have to hit the database each time.

Key Points

Example

A lookup table like Country or Currency, which rarely changes but is read constantly across the application, is a good second-level cache candidate — caching it avoids re-querying the database on every request that needs a country name.

Interview Tip

A concise interview answer is

The second-level cache sits at the SessionFactory level and is shared across sessions, unlike the first-level cache which is per-session. It needs an external provider like Ehcache configured, and it's most valuable for read-heavy, rarely-changing reference data rather than frequently updated entities.

Last updated: 16 July 2026

Previous question: What is the purpose of the Configuration class in Hibernate?

Next question: What is the difference between get() and load() in Hibernate?

More Hibernate (Optional) interview questions

All Hibernate (Optional) questions