Hibernate second level cach

本文详细介绍了Hibernate二级缓存的作用及实现方式,包括提高性能和集群支持的目的,以及EHCache、OSCache和SwarmCache等不同类型的缓存。此外还介绍了配置缓存策略的方法,涉及hibernate.cfg.xml和ehcache.xml文件的设置。

Q: Why hibernate second level cach?

A: Improve performent and cluster.

Q: How many kinds of second level?

A: EHCache, OSCache, SwarmCache.

Q: What can be catch?

A:  Properties and Object.

Q: How to implement second level cach?

A:

1. Config in hibernate.cfg.xml:

<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>

 <property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>     <property name="transaction.manager_lookup_class">org.hibernate.transaction.WeblogicTransactionManagerLookup</property>

(while write cache existed)

2. Edit default or specified cache strategies in ehcache.xml

3. Define  cach class(in hibernate.cfg.xml(usage, include) : cache-class, cache-collections(certain object's collection properties), in *.hbm.xml: cach)

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值