您是指一级缓存还是二级缓存?使用诸如Ehcache之类的Hibernate二级缓存来缓存与您手动修改的同一表中的行相对应的实体,可能会导致您描述的行为。一级缓存不会导致此行为,而且我认为您也不能禁用它。
要禁用Hibernate二级缓存,请从Hibernate配置文件中删除
hibernate-cfg.xml所有引用二级缓存的行。例如:
<!-- Enable the second-level cache --><property name="hibernate.cache.provider_class"> net.sf.ehcache.hibernate.EhCacheProvider</property><property name="hibernate.cache.region.factory_class"> net.sf.ehcache.hibernate.EhCacheRegionFactory</property><property name="hibernate.cache.use_query_cache">true</property><property name="hibernate.cache.use_second_level_cache">true</property><property name="hibernate.cache.use_structured_entries">true</property> <property name="hibernate.cache.generate_statistics">true</property>



