环境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)

注解进行控制
 
 

Mysql 错误 Connection is read-only 解决方式的更多相关文章

  1. Mysql错误: Lock wait timeout exceeded 解决办法

    一.临时解决办法: 执行mysql命令:show full processlist; 然后找出插入语句的系统id 执行mysql命令:kill id 或 首先,查看数据库的进程信息: show ful ...

  2. spark分片个数的确定及Spark内存错误(GC error)的迂回解决方式

    我们知道,spark中每个分片都代表着一部分数据,那么分片数量如何被确认的呢? 首先我们使用最常见的HDFS+Spark,sparkDeploy的方式来讨论,spark读取HDFS数据使用的是spar ...

  3. mac 安装mysql特种报错的对应解决方式

    参考 :http://www.jianshu.com/p/776e72742c6e 原文废话太多了, 还是看我的好了. 配置环境变量 echo "export PATH=$PATH:/usr ...

  4. mysql limit 偏移量过大效率解决方式 转贴

    原文地址:https://www.jianshu.com/p/f8d81df7ab28 SELECT * FROM product , ) limit SELECT * FROM product a ...

  5. Android Studio 错误: 非法字符: &#39;\ufeff&#39; 解决方式|错误: 须要class, interface或enum

    在导入eclipse项目到Android Studio出现这种错误, 非法字符: '\ufeff' 解决方式|错误: 须要class, interface或enum.查阅后了解到Eclipse能够智能 ...

  6. 使用AndroidStudio编译NDK的方法及错误解决方式

    參考资料: [android ndk]macos环境下Android Studio中利用gradle编译jni模块及配置:http://demo.netfoucs.com/ashqal/article ...

  7. MySQL安装过程中出现“APPLY security settings错误”的解决方式

    ***********************************************声明*************************************************** ...

  8. Mysql错误:Ignoring query to other database解决方法

    Mysql错误:Ignoring query to other database解决方法 今天登陆mysql show databases出现Ignoring query to other datab ...

  9. 解决Only a type can be imported. com.mysql.jdbc.Connection resolves to a package的报错问题

    写jsp加载数据驱动以后老是提示Only a type can be imported. com.mysql.jdbc.Connection resolves to a package的错误,然而改成 ...

随机推荐

  1. 安装SQL Server 2008R2 报错“此计算机上安装了 Microsoft Visual Studio 2008 的早期版本”解决方法

    安装SQL Server 2008 R2报错“此计算机上安装了 Microsoft Visual Studio 2008 的早期版本,请在安装 SQL Server 2008 前将 VS2008 升级 ...

  2. C# 在DataGridView中,点击单元格调出 TreeView控件 或 ListBox控件

    1.调出 TreeView控件 或  ListBox控件 private void deductGrid1_CellClick(object sender, DataGridViewCellEvent ...

  3. 理解Raft协议

    目录 1.Paxos算法存在的问题 2.Raft算法     2.1 复制状态机     2.2. Raft算法     2.2.1 安全性问题     2.2.2 Leader选举     2.2. ...

  4. Java容器的常见问题

    记录Java容器中的常见概念和原理 参考: https://github.com/wangzhiwubigdata/God-Of-BigData#三Java并发容器 https://blog.csdn ...

  5. Codeforces Round #567 (Div. 2) B. Split a Number

    Split a Number time limit per test 2 seconds memory limit per test 512 megabytes input standard inpu ...

  6. imread()用法|| root权限

    1.ushort用法? USHORT is a macro which is not part of the official C++ language (it's probably defined ...

  7. TorchScript简介

    本教程是对TorchScript的简介,TorchScript是PyTorch模型(nn.Module的子类)的中间表示,可以在高性能环境(例如C )中运行. 在本教程中,我们将介绍: PyTorch ...

  8. TensorFlow v2.0实现逻辑斯谛回归

    使用TensorFlow v2.0实现逻辑斯谛回归 此示例使用简单方法来更好地理解训练过程背后的所有机制 MNIST数据集概览 此示例使用MNIST手写数字.该数据集包含60,000个用于训练的样本和 ...

  9. 深度强化学习(DRL)专栏开篇

    2015年,DeepMind团队在Nature杂志上发表了一篇文章名为"Human-level control through deep reinforcement learning&quo ...

  10. kaggle入门——泰坦尼克之灾

    目录 引言 数据认识 总结 特征处理 建模预测 logistic分类模型 随机森林 SVM xgboost 模型验证 交叉验证 学习曲线 高偏差: 高方差 模型融合 总结 后记 引言 一直久闻kagg ...