飙血推荐
  • HTML教程
  • MySQL教程
  • JavaScript基础教程
  • php入门教程
  • JavaScript正则表达式运用
  • Excel函数教程
  • UEditor使用文档
  • AngularJS教程
  • ThinkPHP5.0教程

决解Connection is read-only. Queries leading to data modification are not allowed

时间:2021-12-15  作者:匿名  

错误的原因

连接只允许用来读取数据

不能用来修改数据

举个例子 ,假如有下面这么个方法

boolean returnBook(Book book)


需要配置下对应的事务

<tx:method name="return*" propagation="REQUIRED" />

不然 就会报 这个 错误


Connection is read-only. Queries leading to data modification are not allowed


事务一般的配置如下

<tx:advice id="txAdvice" transaction-manager="transactionManager">
        <tx:attributes>
        <tx:method name="save*" propagation="REQUIRED" />
        <tx:method name="del*" propagation="REQUIRED" />
        <tx:method name="update*" propagation="REQUIRED" />
        <tx:method name="*" read-only="true" />
        </tx:attributes>
</tx:advice>

湘ICP备14001474号-3  投诉建议:234161800@qq.com   部分内容来源于网络,如有侵权,请联系删除。