hibernate 2级缓存问题
问题描述:
今天在做一个更新操作时采用 HibernateTemplate 中这个方法this.getHibernateTemplate().bulkUpdate(hql, values);
做的时候发现更新后页面查询数据时候缓存没有并没有更新读是旧的数据.后换成this.hibernateTemplate.update(entity);发现在缓存数据更新了正常了.很想知道真正的原因是什么,不知道谁能给我个明确答案。
${hibernate.dialect}
${hibernate.show_sql}
${hibernate.format_sql}
thread
com.googlecode.hibernate.memcached.MemcachedCacheProvider
true
true
localhost:11211
这里我的缓存部分配置。。。。。。。。。。。。。。。。
答
级联更新,bulkUpdate方法是不会更新二级缓存的! 具体你可以查看Hibernate源码。