从hibernate3升级到hibernate 4.2

时间:2016-02-15 07:25:47

标签: java spring hibernate

有任何帮助如何更改hibernate 4.2的参数,因为我收到以下错误

<bean name="openSessionInViewInterceptor"
    class="org.springframework.orm.hibernate4.support.OpenSessionInViewInterceptor">
    <property name="sessionFactory">
        <ref bean="sessionFactory" />
    </property>
</bean>


   User user2 = new User();
   user2.setUserName(testDO.getUserName());
    user2.setRegisterCode(code);
    user2.setLastUpdateOn(DateUtil.getCurrentDate());
    testDAO.saveOrUpdateObject(user2);

错误:

  

org.springframework.dao.InvalidDataAccessApiUsageException:写   只读模式下不允许操作(FlushMode.MANUAL):转动   你的Sessionnto FlushMode.COMMIT / AUTO或删除   &#39; readOnly的&#39;来自交易定义的标记。在   org.springframework.orm.hibernate4.HibernateTemplate.checkWriteOperationAllowed(HibernateTemplate.java:1128)

0 个答案:

没有答案