Mike: How do you turn the "second_level_cache" on? I've added that to
the applicationConext-hibernate.xml, but still got the same error.
<property name="hibernateProperties">
<props>
<prop
key="hibernate.dialect">@HIBERNATE-DIALECT@</prop>
<prop
key="hibernate.query.substitutions">true 'Y', false 'N'</prop>
<prop
key="hibernate.cache.use_second_level_cache">true</prop>
<prop
key="cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop
key="hibernate.generate_statistics">true</prop>
</props>
</property>
Qin
________________________________
From: Michael Horwitz [mailto:[EMAIL PROTECTED]
Sent: Monday, January 29, 2007 9:12 AM
To: [email protected]
Subject: Re: [appfuse-user] Turn on Ehcache in Appfuse
You need to set the hibernate property
hibernate.cache.use_second_level_cache to true, and if you want to use
query caches you need to set hibernate.cache.use_query_cache true as
well. Note that for the query cache you will need to enable caching on a
query by query basis.
Mike.
On 1/29/07, Ding, Qin <[EMAIL PROTECTED]> wrote:
I try to use ehcache in my appfuse 1.9.4 application.
In applicatonContext-hibernate.xml, <property
name="hibernateProperties">
I added following:
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">@HIBERNATE-DIALECT@</prop>
<prop key="hibernate.query.substitutions">true 'Y', false 'N'</prop>
<prop
key="cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.generate_statistics">true</prop>
</props>
</property>
In Status pojo, I added this xdoclet attribute:
[EMAIL PROTECTED] table="status"
[EMAIL PROTECTED] usage="read-write"
In ehcache.xml, besides the defaultCache, I added
<cache
name="com.mycompany.model.Status"
maxElementsInMemory="10"
eternal="false"
timeToIdleSeconds="0"
timeToLiveSeconds="0"
overflowToDisk="true" />
Then I compile and deploy to tomcat, the application failed to start
with very long error stack trace msg. It seems caused by:
Caused by: org.hibernate.cache.NoCachingEnabledException: Second-level
cache is not enabled for usage [hibernate.cache.use_second_level_cache |
hibernate.cache.use_query_cache ]
at
org.hibernate.cache.NoCacheProvider.buildCache(NoCacheProvider.java:21)
at
org.hibernate.cache.CacheFactory.createCache(CacheFactory.java:61)
... 142 more
My question: besides what I have done, what else should I add in order
to enable second-level cache?