Hibernate second level cach

本文介绍Hibernate二级缓存的重要性及其配置方法。通过使用EHCache等缓存方案,可以显著提升性能并支持集群部署。文章详细说明了如何在Hibernate中配置缓存,并介绍了缓存策略设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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、付费专栏及课程。

余额充值