如何配置spring 3.1.4的OpenSessionInviewWinterCeptor的flushMode属性

如何配置spring 3.1.4的OpenSessionInviewWinterCeptor的flushMode属性,spring,hibernate,spring-mvc,spring-webflow,Spring,Hibernate,Spring Mvc,Spring Webflow,因为我计划从hibernate3升级到hibernate4,从Spring3.0.5升级到Spring3.1.4 我已经在Spring3.0.5中配置了OpenSessionInviewWinterCeptor,所以希望在3.1.4中配置相同的版本 但我无法在Spring3.1.4的OpenSessionInviewWinterCeptor中配置flushMode 我以前对spring 3.0.5的设置是: 在spring 3.1.4中,除了org.springframework.orm.hib

因为我计划从hibernate3升级到hibernate4,从Spring3.0.5升级到Spring3.1.4

我已经在Spring3.0.5中配置了OpenSessionInviewWinterCeptor,所以希望在3.1.4中配置相同的版本

但我无法在Spring3.1.4的OpenSessionInviewWinterCeptor中配置flushMode

我以前对spring 3.0.5的设置是:

在spring 3.1.4中,除了org.springframework.orm.hibernate3.HibernateAccessor之外,没有找到类似的类

所以我的问题是如何设置Spring3.1.4的OpenSessionInviewWinterCeptor的flushMode属性

它就像一团乱,没有绑定到属性访问器的链接。我猜拷贝粘贴工作是在没有考虑清理不同继承层次结构的情况下完成的。我讨厌这种情况发生

你能改用Hibernate3版本吗?是的,它确实出现在那里;以下是链接:


从长远来看,请更仔细地查看Hibernate4代码是否在根本不指定标志的情况下实现了您想要的功能。不幸的是,至少现在你必须忽略文档,研究一下文档本身。

是的,我知道它只是一个复制粘贴,而且在spring 3.1.4的OpenSessionInviewWinterCeptor中没有属性访问器,这就是为什么我要问一些方法来做到这一点。事实上,我想在我的应用程序中集成Hibernate搜索,这就是为什么要使用Hibernate 4和spring 3.1.4。我们可以使用org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor和所有设置4版本吗。当我尝试这样做时,出现了以下异常:java.lang.NoSuchMethodError:org.hibernate.SessionFactory.opensessionorg/hibernate/classic/Session;
<bean name="openSessionInViewInterceptor"
      class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor">
      <property name="sessionFactory">
             <ref bean="sessionFactory" />
      </property>
      <property name="flushMode">
             <bean
                   id="org.springframework.orm.hibernate3.HibernateAccessor.FLUSH_NEVER"
                   class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean" />
      </property>
</bean>
<bean name="openSessionInViewInterceptor"
    class="org.springframework.orm.hibernate4.support.OpenSessionInViewInterceptor">
    <property name="sessionFactory">
        <ref bean="sessionFactory" />
    </property>
    <property name="flushMode">
        <bean
            id="org.springframework.orm.hibernate3.HibernateAccessor.FLUSH_NEVER"
            class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean" />
    </property>
</bean>
org.springframework.beans.NotWritablePropertyException: Invalid property 'flushMode' of bean class [org.springframework.orm.hibernate4.support.OpenSessionInViewInterceptor]: Bean property 'flushMode' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?