Connection is read-only. Queries leading to data modification are not allowed
如果出现以上的错误可能是由于事务配置文件上
<tx:advice id="txAdvice">
<tx:attributes>
<tx:method name="*" read-only="true" />
<tx:method name="insert*" />
<tx:method name="update*" />
<tx:method name="delete*" />
</tx:attributes>
</tx:advice>
当方法名字开头不包含指定的名字时 会自动用默认的事务
但此事务是read_only="true" 所以才有"Connection is read-only. Queries leading to data modification are not allowed"的错误
解决方案有2种
1.规范命名
2.删除
<tx:method name="*" read-only="true" />
(不推荐)