日期:2014-05-16  浏览次数:20393 次

使用ssh过程中对数据库进行update时报错

报错信息:org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition


beans.xml中的问题
<!-- 事务切面 -->
<bean id="tx" class="org.springframework.transaction.interceptor.TransactionInterceptor"> 
<property name="transactionManager" ref="tm"></property>

<property name="transactionAttributes">
<props>
<prop key="reg">PROPAGATION_REQUIRED</prop>
<prop key="task_*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>


加上红色部分语句就ok了!