- <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
- <prop key="hibernate.cache.use_query_cache">true</prop>
2.爲HBM表設置cache策略
- <cache usage="nonstrict-read-write"/>
3.在DAO中,調用find方法查詢之前,設置使用緩存
- getHibernateTemplate().setCacheQueries(true);