I used Roo to build a JPA/Hibernate application and I now want to make use of Spring's Cache abstraction that came out in 3.1.
when I add @Cacheable(value = "subjects") like so to the Roo generated method (after pushing the method into the main class:
I get the follow error:Code:@Cacheable(value="subjects") public static List<Subject> findAllSubjects() { return entityManager().createQuery("SELECT o FROM Subject o", Subject.class).getResultList(); }
Here are my relevant configurations:Code:Data access failure Sorry, a problem occurred while accessing the database. Details org.hibernate.InstantiationException: Could not instantiate entity: edu.wisc.acadprop.domain.Subject; nested exception is javax.persistence.PersistenceException: org.hibernate.InstantiationException: Could not instantiate entity: edu.wisc.acadprop.domain.Subject org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:326) org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect.ajc$afterThrowing$org_springframework_orm_jpa_aspectj_JpaExceptionTranslatorAspect$1$18a1ac9(JpaExceptionTranslatorAspect.aj:15)
ehcache.xml
applicationContext.xmlCode:<?xml version="1.0" encoding="UTF-8"?> <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"> <defaultCache maxElementsInMemory="1000" eternal="false" overflowToDisk="true" memoryStoreEvictionPolicy="LFU" /> <cache name="subjects" maxElementsInMemory="500" eternal="false" overflowToDisk="false" memoryStoreEvictionPolicy="LFU" /> </ehcache>
If I comment out @Cacheable, things work fine.Code:<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"> <property name="cacheManager" ref="ehcache"></property> </bean> <bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> <property name="configLocation" value="classpath:ehcache.xml"></property> </bean>
What am I missing?


Reply With Quote