Skip to content

Conversation

@candrews
Copy link

I don't think Hibernate and Hibernate4 should depend on ehcache at all.

It seems to me that caching is a separate concern that should be addressed by a separate plugin (namely, the cache-ehcache plugin).

Setting up Hibernate caching with ehcache properly isn't as simple as how it's currently done in the Hibernate/Hibernate4, too:
cache.provider_class='net.sf.ehcache.hibernate.EhCacheProvider'
That isn't right because with that setup, there's a separate ehcache instance set up just for Hibernate, and it is only configurable using the default class path ehcache.xml (which falls back to ehcache-failsafe.xml). It doesn't get shutdown safely either (whereas the cache-ehcache plugin does safely shut it down) which causes problems when running distributed, or with a disk backing store.

I think the correct way to configure Hibernate with ehcache is as documented in the cache-ehcache plugin at https://grails-plugins.github.io/grails-cache-ehcache/guide/usage.html :
cache.region.factory_class = 'grails.plugin.cache.ehcache.hibernate.BeanEhcacheRegionFactory' // For Hibernate before 4.0
cache.region.factory_class = 'grails.plugin.cache.ehcache.hibernate.BeanEhcacheRegionFactory4' // For Hibernate before 4.0 and higher

You can see BeanEhcacheRegionFactory at https://github.com/grails-plugins/grails-cache-ehcache/blob/master/src/java/grails/plugin/cache/ehcache/hibernate/BeanEhcacheRegionFactory.java

In short, I propose the ehcache dependency be dropped from both plugins, and people use cache-ehcache if they want to use ehcache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant