Home » Caching in Hibernate

Caching in Hibernate

by Online Tutorials Library

Caching in Hibernate

Hibernate caching improves the performance of the application by pooling the object in the cache. It is useful when we have to fetch the same data multiple times.

There are mainly two types of caching:

  • First Level Cache, and
  • Second Level Cache

First Level Cache

Session object holds the first level cache data. It is enabled by default. The first level cache data will not be available to entire application. An application can use many session object.

Second Level Cache

SessionFactory object holds the second level cache data. The data stored in the second level cache will be available to entire application. But we need to enable it explicitely.

  • EH (Easy Hibernate) Cache
  • Swarm Cache
  • OS Cache
  • JBoss Cache

You may also like