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.
user236801 May 19 '17 at 8:52 2017-05-19 08:52
source share