您的位置:首页 > 博客中心 > 数据库 >

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

时间:2022-03-10 17:00

报错信息: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了!

热门排行

今日推荐

热门手游