本帖最后由 huaxianpeng 于 2009-11-30 16:56:44 编辑

解决方案 »

  1.   

    session.setCacheMode(CacheMode.IGNORE)
      

  2.   

    applicationContext.xml中配有
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.SQLServerDialect
    </prop>
    <prop key="hibernate.cache.use_second_level_cache">
    true
    </prop>
    <prop key="hibernate.cache.provider_class">
    <!-- org.hibernate.cache.OSCacheProvider-->
    org.hibernate.cache.EhCacheProvider
    </prop>
    <prop key="hibernate.show_sql">
    true
    </prop>
    <prop key="hibernate.cache.use_query_cache">
                        true
                    </prop>
                   
    </props>
    </property>我实体映射文件里配的是 
      <cache usage="read-write" region="sampleCache1"/> 
      

  3.   

    查询语句写了
    super.getHibernateTemplate().setCacheQueries(true);