首页 > 数据库> > java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
作者:互联网
今天更新数据时出现这个错误:
java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
原因是:我在service层设置了只读。@Transactional(readOnly = true)
而更新的方法没有把可读设置为FALSE。解决办法是在方法上加上readOnly=FALSE
注解如下: @Transactional(readOnly = false, isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED)
标签:java,read,leading,Transactional,allowed,readOnly,sql,data 来源: https://www.cnblogs.com/Fooo/p/14036359.html