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

错误描述

调用save()方法报错 Connection is read-only. Queries leading to data modification are not allowed

产生原因

让所有的方法都加入事务管理,类前面加了注解 @Transactional(readOnly = true)

设置为只读的事务,但是增删改就会报错 Connection is read-only.

解决方法

方法设置,可读可写即可加上如下注解:

@Transactional(readOnly = false)

	@Transactional(readOnly = false)
	public void insertOrUpdateByIdCard(YwPerson ywPerson) {
		super.save(ywPerson);
	}

 

posted @ 2019-09-18 16:25  随风落木  阅读(0)  评论(0编辑  收藏  举报  来源