首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

spring Jpa hibernate缓存配备

2012-11-07 
spring Jpa hibernate缓存配置?1.applicationContext.xml中加入prop? keyhibernate.cache.region.facto

spring Jpa hibernate缓存配置

?

1.applicationContext.xml中加入

<prop? key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
??? ??? ??? ??? </prop>
??? ??? ??? ??? <prop key="net.sf.ehcache.configurationResourceName">ehcache/ehcache-hibernate-local.xml</prop>

?

2.配置ehcache-hibernate-local.xml

?

3.pom中加入缓存依赖

??? <!-- ehcache -->
??? ??? <dependency>
??? ??? ??? <groupId>net.sf.ehcache</groupId>
??? ??? ??? <artifactId>ehcache-core</artifactId>
??? ??? ??? <version>2.5.1</version>
??? ??? </dependency>
??? <!-- CACHE end -->

4.web.xml中

?

<!-- Open Entity Manager in View filter? 此处为延迟加载-->

?

?

??? 具体原因请参照http://blog.csdn.net/snoopy93/article/details/7101816

?

??? <filter>
??? ??? <filter-name>openEntityManagerInViewFilter</filter-name>
??? ??? <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
??? </filter>
??? <filter-mapping>
??? ??? <filter-name>openEntityManagerInViewFilter</filter-name>
??? ??? <url-pattern>/*</url-pattern>
??? </filter-mapping>

?5.接下来就是自己写注解的问题了

?

?

?

?

热点排行