Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

What are the different caching services provided by the Hibernate?
Hibernate supports four different caching services.  EHCache (Easy Hibernate Cache) is the default service. If you prefer to use an alternative cache, you need to set the cache.provider_class property in the hibernate.cfg.xml file:

    <property name="cache.provider_class">
      org.hibernate.cache.OSCacheProvider
    </property>
This snippet sets the cache provider to the OSCache caching service.

Caching Services Supported by Hibernate:
  * EHCache
  * OSCache
  * SwarmCache
  * TreeCache

REPLY :
The second-level cache in hibernate is associated with the Session Factory.
The first Level of cache is associated with session object.
Hibernate supports by default first level of cache.We cant disable first level of cache.
Hibernate provide supports for following main Cache provider
EHCache:It supports read-only and read/write caching, and memory- and disk-based caching.It is a fast,lightweight,and easy-to-use in-process cache. It does not support clustering.

OSCache(open-source caching):It supports read-only and read/write caching, and memory- and disk-based caching .It also provides basic support for clustering via either JavaGroups or JMS.
 
SwarmCache:cluster-based caching solution based on JavaGroups. It supports read-only or nonstrict read/write caching 

JBoss TreeCache :transactional cache & Read-only