Connection is read-only. Queries leading to data modification are not allowed 错误原因
Posted li-zhi-long
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Connection is read-only. Queries leading to data modification are not allowed 错误原因相关的知识,希望对你有一定的参考价值。
因为我再spring 中使用了AOP进行事务管理,有如下配置
<tx:advice id="txAdvice" transaction-manager="transactionManager"> <!-- 定义事务传播属性 --> <tx:attributes> <tx:method name="insert*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="edit*" propagation="REQUIRED" /> <tx:method name="save*" propagation="REQUIRED" /> <tx:method name="add*" propagation="REQUIRED" /> <tx:method name="new*" propagation="REQUIRED" /> <tx:method name="set*" propagation="REQUIRED" /> <tx:method name="remove*" propagation="REQUIRED" /> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="change*" propagation="REQUIRED" /> <tx:method name="get*" propagation="REQUIRED" read-only="true" /> <tx:method name="find*" propagation="REQUIRED" read-only="true" /> <tx:method name="load*" propagation="REQUIRED" read-only="true" /> <tx:method name="*" propagation="REQUIRED" read-only="true" /> </tx:attributes> </tx:advice>
对于get find load 开头和其他所有方法都设置了只读,不能修改、删除、插入 操作。而我执行的方法名以Insert 开头大小写不一致导致当前事务是只读的,执行插入操作就会报以上错误。
以上是关于Connection is read-only. Queries leading to data modification are not allowed 错误原因的主要内容,如果未能解决你的问题,请参考以下文章
spring+struts+mybatis中关于报错org.hibernate.exception.GenericJDBCException: Connection is read-only. Que
### Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are
Connection is read-only. Queries leading to data modification are not allowed 错误原因
Connection is read-only. Queries leading to data modification are not allowed
java后台程序方法执行数据库读写报错Connection is read-only。Queries leading to data modification