Hi,
I want to use @cachable for my JPA2-Entities. I'm using spring 3.1 and Hibernate 4.1.6.Final and I want to use eh-cache as cache.
Although I followed the tips here:
http://www.javacraft.org/2012/03/mig...4-ehcache.html
I still get java.lang.NoClassDefFoundError: org/hibernate/cache/TimestampsRegion.
Has this something to do with spring 3.1?
Thank you.
P.S. EntityManager:
persistence.xml:Code:<bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory"/> </bean> <tx:annotation-driven transaction-manager="transactionManager" order="35"/> <bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory"> <property name="persistenceUnitName" value="persistenceUnit"/> <property name="dataSource" ref="dataSource"/> </bean>
Code:<?xml version="1.0" encoding="UTF-8" standalone="no"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServer2008Dialect"/> <!-- value="create" to build a new database on each run; value="update" to modify an existing database; value="create-drop" means the same as "create" but also drops tables when Hibernate closes; value="validate" makes no changes to the database --> <property name="hibernate.hbm2ddl.auto" value="validate"/> <property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.DefaultComponentSafeNamingStrategy"/> <property name="hibernate.connection.charSet" value="UTF-8"/> <property name="hibernate.cache.region.factory_class" value ="net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory" /> <property name="hibernate.cache.use_second_level_cache" value="true" /> <property name="hibernate.cache.use_query_cache" value="true" /> <property name="net.sf.ehcache.configurationResourceName" value="myehcache.xml"/> </properties> </persistence-unit> </persistence>


Reply With Quote