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

被折叠的 条评论
为什么被折叠?



