The error occurred while setting parameters
### SQL: update t_trade set delete_status = 0 where order_id = ?
### Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
2019-04-25 18:12:04.014 [ ERROR ] ->* ; ]; Connection is read-only. Queries leading to data modification are not allowed; nested exception is java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
查询资料后知道是事务配置的关系。报错的是接口方法名为:,
将get去掉后错误就没有了,原因是什么呢,原来是前辈在配置类中有这么一段代码:
// 创建事务通知
@Bean(name = “txAdvice”)
public TransactionInterceptor getAdvisor() throws Exception {
Properties properties = new Properties();
properties.setProperty(“get*”, “PROPAGATION_REQUIRED,-Exception,readOnly”);
properties.setProperty(“find*”, “PROPAGATION_REQUIRED,-Exception,readOnly”);
properties.setProperty(“query*”, “PROPAGATION_REQUIRED,-Exception,readOnly”);
properties.setProperty(“select*”, “PROPAGATION_REQUIRED,-Exception,readOnly”);
properties.setProperty(“list*”, “PROPAGATION_REQUIRED,-Exception,readOnly”);
properties.setProperty(“search*”, “PROPAGATION_REQUIRED,-Exception,readOnly”);
/*
* 关闭所有不符合以上命名的方法都开启事务
/
//properties.setProperty("", “PROPAGATION_REQUIRED,-Exception”);
TransactionInterceptor tsi = new TransactionInterceptor(transactionManager, properties);
return tsi;
}
前辈写了一个切面,凡是不符合这些名词的方法都开启事务并且设置了readOnly,是一个蛮实用的方法,省去很多方法都要加事务注解的麻烦。
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数同学面临毕业设计项目选题时,很多人都会感到无从下手,尤其是对于计算机专业的学生来说,选择一个合适的题目尤为重要。因为毕业设计不仅是我们在大学四年学习的一个总结,更是展示自己能力的重要机会。
因此收集整理了一份《2024年计算机毕业设计项目大全》,初衷也很简单,就是希望能够帮助提高效率,同时减轻大家的负担。
既有Java、Web、PHP、也有C、小程序、Python等项目供你选择,真正体系化!
由于项目比较多,这里只是将部分目录截图出来,每个节点里面都包含素材文档、项目源码、讲解视频
如果你觉得这些内容对你有帮助,可以添加VX:vip1024c (备注项目大全获取)
1024c (备注项目大全获取)**
[外链图片转存中…(img-ObH1EeLX-1712545532430)]