GRAILS default Hibernate cache configuration

The Grails 2.0.0 reference manual shows the following as the default Hibernate cache configuration

hibernate {
cache.use_second_level_cache=true
cache.use_query_cache=true
cache.provider_class='org.hibernate.cache.EhCacheProvider'
}

But if you create a Grails 2.0.0 application, what you actually get is

hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = true
cache .region.factory_class ='net.sf.ehcache.hibernate.EhCacheRegionFactory'
}

Can someone explain the difference between the two?

CacheProvider is a legacy and deprecated way to define the second Level cache implementation, as shown in its javadoc. The new method is to use regional factories.

For details, see http://docs.jboss.org/hibernate/core/3.6/javadocs/ org/hibernate/cache/package-summary.html.

The Grails 2.0.0 reference manual shows the following as the default Hibernate cache configuration

hibernate {
cache.use_second_level_cache=true
cache.use_query_cache=true
cache.provider_class='org.hibernate.cache.EhCacheProvider'
)

But if you create a Grails 2.0.0 application, what you actually get is

hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = true
cache.region.factory_class ='net.sf.ehcache.hibernate.EhCacheRegionFactory'
}

Can someone explain both What is the difference between?

CacheProvider is a legacy and deprecated way to define the second-level cache implementation to be used, as shown in its javadoc. It is to use the regional factory.

For details, see http://docs.jboss.org/hibernate/core/3.6/javadocs/org/hibernate/cache/package-summary.html.

Leave a Comment

Your email address will not be published.