Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
解决:Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
在实现类中将对应方法的@Transactional注解的readOnly=true 的权限改为
readOnly = false
一般执行增删改时可将权限改为 false ,执行查询语句时改为true
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" rollback-for="Exception"/>
<tx:method name="save*" propagation="REQUIRED" rollback-for="Exception"/>
<tx:method name="edit*" propagation="REQUIRED" rollback-for="Exception"/>
<tx:method name="update*" propagation="REQUIRED" rollback-for="Exception"/>
<tx:method name="delete*" propagation="REQUIRED" rollback-for="Exception"/>
<tx:method name="do*" propagation="REQUIRED" rollback-for="Exception"/>
<tx:method name="*" propagation="REQUIRED" read-only="false"/>
<tx:method name="select*" propagation="REQUIRED" read-only="true"/>
</tx:attributes>
</tx:advice>