Hi i am new in JPA EHcache...Integrating JPA(Hibernate) with spring and trying to use EHCache. May be this topic has been discussed ...i am using same and also followed many others website. But not able to resolve the problem.
my files are following.
persistence.xml
ehcache.xmlCode:<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" /> <property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.EhCacheProvider" /> <property name="hibernate.cache.use_second_level_cache" value="true" /> <property name="net.sf.ehcache.configurationResourceName" value="/ehcache.xml" /> <property name="hibernate.cache.use_structured_entries" value="true"/> <property name="hibernate.cache.use_query_cache" value="true" /> <property name="hibernate.generate_statistics" value="true" />
ApplicationContext.xmlCode:<ehcache> <diskStore path="java.io.tmpdir"/> <defaultCache eternal="true" overflowToDisk="false" maxElementsInMemory="50000" timeToIdleSeconds="30" timeToLiveSeconds="6000" /> <cache name="com.model.Customer" maxElementsInMemory="5000" eternal="false" overflowToDisk="false" /> </ehcache>
Code:<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="showSql" value="true" /> <property name="generateDdl" value="true" /> <property name="databasePlatform" value="${db.dialect}" /> </bean> </property> <property name="persistenceUnitManager" ref="persistenceUnitManager" /> <property name="persistenceUnitName" value="testPersUnit" /> <property name="dataSource" ref="dataSource"/> </bean> <bean id="persistenceUnitManager" class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager" lazy-init="default"> <property name="loadTimeWeaver" ref="loadTimeWeaver" /> <property name="persistenceXmlLocations"> <list> <value>classpath*:/META-INF/persistence.xml</value> </list> </property> <property name="defaultDataSource" ref="dataSource"/> </bean> <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="${db.dataSource}"/> </bean>
plz give any solutions..thnx in advance.![]()


Reply With Quote