Hibernate Books

All times are UTC - 5 hours [ DST ]

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: what is hibernate's Default Second Level (L2) Cache
PostPosted: Mon Nov 29, 2010 1:41 pm 

Joined: Thu Nov 18, 2010 1:46 pm
Posts: 3
In the hibernate documentation (http://docs.jboss.org/hibernate/core/3.5/reference/en/html/performance.html), it says:

20.2. The Second Level Cache
You have the option to tell Hibernate which caching implementation to use by specifying the name of a class that implements org.hibernate.cache.CacheProvider using the property hibernate.cache.provider_class. Hibernate is bundled with a number of built-in integrations with the open-source cache providers that are listed below. You can also implement your own and plug it in as outlined above. Note that versions prior to 3.2 use EhCache as the default cache provider.

What is the default behavior for v3.3+?
Does it still default to EhCache?
Does just listing a cache provider hibernate.cache.provider_class turn on the L2 cache and use that provider? or do I have to actually specify a <cache> mapping?
Do I have to turn it on with hibernate.cache.use_second_level_cache="true"?
Is there any other way to turn it on/off say programmatically?
How do these settings effect the loading of the classes for the L2 cache (ie. do EhCache classes automatically get class loaded since its the default? and when? Would other L2 cache impl classes get loaded the same way and time?)

It seems that one of my questions (Do I still need to turn it on with hibernate.cache.use_second_level_cache="true"?) was already answered in the v3.5 doc:
"hibernate.cache.use_second_level_cache Can be used to completely disable the second level cache, which is enabled by default for classes which specify a <cache> mapping." So it seems that L2 cache is enabled by default... to which impl though.

The 3.6 documentation's tutorial (ch1) has the following:
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
Would this be a way of not only disabling the L2 cache, but also preventing the loading of the default L2 cache by the class loader?

 Post subject: Re: what is hibernate's Default Second Level (L2) Cache
PostPosted: Sun Sep 11, 2011 6:28 am 

Joined: Sun May 02, 2004 12:02 pm
Posts: 4
Location: Belgie
From issue HHH-1795 https://hibernate.onjira.com/browse/HHH-1795 [FIXED]:
Due to the upgrade to EhCache1.2 and its new non-singleton cache setup, we should no longer default the cache provider to be ehcache. Instead, default to NoCacheProvider.


I've got plenty of Java and Chesterfield Kings
The nightfly - Donald Fagen

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.