Jason Trinity wrote:-The project already had hibernate. It had a hibernate3.jar that I figured out was hibernate-3.6.0-CR2. I replaced it with hibernate-core-3.6.10.Final.jar. The code ran fine.
-Added ehcache-core-2.4.3.jar and hibernate-ehcache-3.6.10.Final.jar, and the code worked fine.
-Added the following lines to the project's config file in the <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> bean, under <property name="hibernateProperties">
...
and I get the error java.lang.ClassNotFoundException: net.sf.ehcache.hibernate.EhCacheRegionFactory cannot be found
Seems you already have made some progress
It seems you are using the appropriate properties and class names in your configuration, so I have no clue what's wrong. The
EhCacheRegionFactory class is definitely in the
ehcache-core-2.4.3.jar dependency. So I'm a bit wondered why this class can not be found.
This tutorial provides an Hibernate EhCache Second Level Caching Example. It uses Hibernate 4, but also mentions the differences with Hibernate 3. So maybe you can go through this tutorial and see if you can spot any differences in your configuration. And
this article also nicely explains how to configure Hibernate 4 with EhCache higher than 2.4.3, but also mentions how to configure EhCache for Hibernate 3. And finally on the EhCache website itself, you'll find also
documentation how to configure it properly.
I think you don't need the
hibernate-ehcache-3.6.10.Final.jar dependency, because it seems the
ehcache-core-2.4.3.jar dependency already contains the necessary classes (see the
net.sf.ehcache.hibernate package). But removing this dependency will probably not solve your issue.
Hope it helps!
Kind regards,
Roel