Hibernate + EhCache 3 XML configuration

Viewed 233

I'm currently in a project which was using Hibernate + EhCache 2.x and working currently my way to migrate it to EhCache 3 but found some questions along the way.

  • I think previously it was possible by XML configuration to provide a name to a cache manager, currently our application creates Hibernate session factories since we have a Multi-tenant implementation so each tenant has a different Session Factory.
<ehcache name="nameOfCacheManager">

I couldn't find a way to do that on the new XSD for EhCache 3 is that no longer possible? https://www.ehcache.org/documentation/3.0/xsds.html#core

  • I'm a little bit lost on the configuration of a Session Factory + the Cache manager that will be used for it, what I found so far is the following:
        <property name="hibernate.cache.region.factory_class">org.hibernate.cache.jcache.JCacheRegionFactory</property>
        <property name="hibernate.javax.cache.provider">org.ehcache.jsr107.EhcacheCachingProvider</property>
        <property name="hibernate.javax.cache.uri">"ehcache.xml"</property>

I currently have that on the file I load to build my Hibernate Session factory, would that effectively create a CacheManager and tie that to the SessionFactory? Just worried I'm missing something.

  • Last but not least is there an equivalent region factory to org.hibernate.cache.ehcache.internal.SingletonEhcacheRegionFactory or I can still use that when on EhCache 3.x

Thank you

0 Answers
Related