• SSM Connection is read-only. Queries leading to data modification are not allowed


    SSM在mybatis执行存储过程时报Connection is read-only. Queries leading to data modification are not allowed

    需要检查applicationContext.xml的配置,看看是不是设置了只读

       <tx:advice transaction-manager="transactionManager" id="adviceId">
            <tx:attributes>
            <!--  其中*为通配符,即代表以find为开头的所有方法,即表示符合此命名规则的方法作为一个事务。 -->
             <!--propagation="REQUIRED"代表支持当前事务,如果当前没有事务,就新建一个事务。这是最常见的选择-->
                <!--propagation="SUPPORTS" 支持当前事务,如果当前没有事务,就以非事务方式执行。 -->
             <!-- isolation DEFAULT:采用数据库默认隔离级别 -->
                <!--read-only   事务是否只读?-->
                <tx:method name="find*" read-only="true"/>
                <tx:method name="select*" read-only="true"/>
                <tx:method name="query*" read-only="false" propagation="REQUIRED" isolation="DEFAULT"/>
                <tx:method name="save*" read-only="false" propagation="REQUIRED"/>
                <tx:method name="update*" read-only="false" propagation="REQUIRED"/>
                <tx:method name="delete*" read-only="false" propagation="REQUIRED"/>
                <tx:method name="insert*" read-only="false" propagation="REQUIRED"/>
            </tx:attributes>
        </tx:advice>
  • 相关阅读:
    HDU4565
    CF861D
    UVA 11651
    HDU5950
    POJ3267
    POJ1094
    POJ1905
    HDU3567
    进程的同步与互斥
    预防死锁,检测死锁,避免死锁,解除死锁....
  • 原文地址:https://www.cnblogs.com/flyxlee/p/14073261.html
Copyright © 2020-2023  润新知