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

执行save方法保存的时候报下列的错
在这里插入图片描述

原因:

让所有的方法都加入事务管理,service类前面加了注解 @Transactional(readOnly = true)
设置为只读的事务,但是增删改就会报错 Connection is read-only.

解决:

方法前面加上注释 @Transactional(readOnly = false)
在这里插入图片描述
就可以啦~

猜你喜欢

转载自blog.csdn.net/weixin_43474476/article/details/118723027