zoukankan      html  css  js  c++  java
  • Mysql 错误 Connection is read-only 解决方式

    环境Spring+Mybatis

    <!-- 配置事务管理器 -->

      <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> 

        <property name="dataSource" ref="dataSource" />

      </bean>
    
    <!-- 声明式事物管理 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="get*" read-only="true" /> <tx:method name="find*" read-only="true" /> <tx:method name="load*" read-only="true" /> <tx:method name="query*" read-only="true" /> <tx:method name="add*" read-only="false" rollback-for="Exception" propagation="REQUIRED"/> <tx:method name="save*" read-only="false" rollback-for="Exception" propagation="REQUIRED"/> <tx:method name="insert*" read-only="false" rollback-for="Exception" propagation="REQUIRED"/> <tx:method name="update*" read-only="false" rollback-for="Exception" propagation="REQUIRED"/> <tx:method name="modify*" read-only="false" rollback-for="Exception" propagation="REQUIRED"/> <tx:method name="delete*" read-only="false" rollback-for="Exception" propagation="REQUIRED"/> <!-- <tx:method name="*" read-only="true"/> --> </tx:attributes> </tx:advice>

    以上只为示例,使用事务控制连接数据库方法规范,只读方法和操作方法

    有的项目中没有配置声明式事务,是在service层用
    @Transactional(readOnly = false)

    注解进行控制
     
     
  • 相关阅读:
    Report parameters
    维护SE16N Maintain entries
    SE16N Related &SAP_EDIT (转载)
    SD增强 MV45AFZZ
    原始系统问题SE03 Original System
    eclipse 连接不上HBase集群
    Hadoop hdfs yarn HA
    hadoop手动启动jobhistory
    hadoop错误提示 exitCode: 1 due to: Exception from container-launch.
    no filesystem for scheme hdfs
  • 原文地址:https://www.cnblogs.com/zhangyihao/p/12736360.html
Copyright © 2011-2022 走看看