<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                工程中默認使用聲明式事務,事務控制在service層,規則定義在transaction.xml文件中 * 以select、query、get等開頭的方法為只讀事務 * 以insert、create、save、do等開頭的方法走事務 所以當控制臺報Connection is read-only錯誤時就要注意下service中方法開頭了 ``` Caused by: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) ``` transaction.xml文件內容 ``` <!-- Spring 通知配置 --> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <tx:method name="select*" read-only="true"/> <tx:method name="query*" read-only="true"/> <tx:method name="get*" read-only="true"/> <tx:method name="load*" read-only="true"/> <tx:method name="list*" read-only="true"/> <tx:method name="insert*" read-only="false" propagation="REQUIRED" rollback-for="Throwable" /> <tx:method name="create*" read-only="false" propagation="REQUIRED" rollback-for="Throwable" /> <tx:method name="save*" read-only="false" propagation="REQUIRED" rollback-for="Throwable" /> <tx:method name="submit*" read-only="false" propagation="REQUIRED" rollback-for="Throwable" /> <tx:method name="update*" read-only="false" propagation="REQUIRED" rollback-for="Throwable" /> <tx:method name="modify*" read-only="false" propagation="REQUIRED" rollback-for="Throwable" /> <tx:method name="del*" read-only="false" propagation="REQUIRED" rollback-for="Throwable" /> <tx:method name="remove" read-only="false" propagation="REQUIRED" rollback-for="Throwable" /> <tx:method name="do*" read-only="false" propagation="REQUIRED" rollback-for="Throwable" /> <tx:method name="*" read-only="true"/> </tx:attributes> </tx:advice> <!-- Spring 事務切面配置 --> <aop:config> <aop:pointcut id="serviceOperation" expression="execution(* org.walkframework.base.mvc.service.*.*.*(..)) or execution(* org.walkframework.base.mvc.service.*.*.*.*(..)) or execution(* com.asiainfo.walk.*.mvc.service.*.*.*(..)) or execution(* com.asiainfo.walk.*.mvc.service.*.*.*.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceOperation" /> </aop:config> ``` **注意:** 當數據庫是mysql時,如果發現方法開頭也對,代碼任何地方也沒問題,但事務始終就是不生效時,這時就要注意下表的存儲引擎類型了,MyISAM是不支持事務的,可考慮改成InnoDB類型
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看