hibernate配置文件:
hibernate Bean配置文件:
或者,class里面加上
DaoImpl:
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
hibernate Bean配置文件:
@Entity
@Cache(usage=CacheConcurrencyStrategy.READ_ONLY)
或者,class里面加上
<cache region="roleTypeEhCache" usage="read-write" />
DaoImpl:
public List<RoleType> loadRoleType(){
HibernateTemplate template = getHibernateTemplate();
template.setCacheQueries(true);
return template.loadAll(RoleType.class);
}