Hi guys,
We've been using Spring Modules to cache some JDBC DAOs for a while now with great success. Now we are slowly starting to migrate some DAOs to use JPA/Hibernate instead and we'd like to cache some of those too. For this we figured that using the Hibernate second-level cache would be appropriate and so we tried configuring it. Unfortunately we now end up with an EHCache (our cache provider) exception which looks like that:
I guess this exception is natural, since two different libraries are trying to use and configure EHCache as their cache provider: Hibernate and Spring Modules. My question is: how can we adapt our current setup so that both these libraries can use EHCache?Code:net.sf.ehcache.CacheException: Cannot parseConfiguration CacheManager. Attempt to create a new instance of CacheManager using the diskStorePath "C:\DOCUME~1\RU9211~1\LOCALS~1\Temp\" which is already used by an existing CacheManager. The source of the configuration was classpath.
Our persistence.xml:
and part of our applicationContext.xml:Code:<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="promoPersistenceUnit" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>model.stores.Store</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect" /> <property name="hibernate.cache.use_second_level_cache" value="true" /> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" /> </properties> </persistence-unit> </persistence>
Thanks a lot!Code:<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" /> <bean id="cacheProvider" class="org.springmodules.cache.provider.ehcache.EhCacheFacade"> <property name="cacheManager" ref="cacheManager" /> </bean>


