What is the second level cache in sleep mode?

What is the second level cache in sleep mode?

+20
java orm hibernate second-level-cache
May 13 '10 at 8:50 a.m.
source share
2 answers

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

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

Layer 2 cache divides the entity in different sessions. This is the SessionFactory level cache.

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

Recommended Indications

+29
May 13 '10 at 16:56
source share

The first level cache is enabled by default and works in the session area. The second level cache is different from the first level cache, which is available for use globally in a factory session. Therefore, a second level cache is created in the factory session area and is available for use in all sessions that are created using this particular factory session. This also means that after closing the factory session, all associated cache and cache manager also close. Whenever a hibernation session tries to load an object, in the very first place it searches for a cached copy of the entity in the first level cache and if there is no cached object in the first level cache, then the second level cache is looked up for the cached object.

0
May 19 '17 at 8:52
source share



All Articles