I see that the cacheProvider property of the SessionFactoryBean is deprecated in 3.0. They suggest replacing it with cacheRegionFactory instead, but I'm having some problems...
first: There doesn't appear to be any RegionFactory implementation for ehCache. Can anyone point me at one?
In the meantime, I'm trying to use org.hibernate.cache.impl.bridge.RegionFactoryCache ProviderBridge, like so:But this gives the following Exception at runtime:Code:<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> . . . <property name="cacheRegionFactory"> <bean id="cacheRegionFactory" class="org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge"> <constructor-arg> <props> <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop> </props> </constructor-arg> </bean> </property> </bean>
I'm using Spring 3.0.0 RELEASE, and Hibernate 3.3.2 GA.Code:org.hibernate.HibernateException: could not instantiate RegionFactory [org.springframework.orm.hibernate3.LocalRegionFactoryProxy] at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:389) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:262) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:855) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:774) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398) ... 28 more Caused by: java.lang.NoSuchMethodException: org.springframework.orm.hibernate3.LocalRegionFactoryProxy.<init>(java.util.Properties) at java.lang.Class.getConstructor0(Class.java:2706) at java.lang.Class.getConstructor(Class.java:1657) at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:384) ... 38 more
Has anyone managed to get this working? Or should I just stick with my deprecated cacheProvider implementation?


Reply With Quote