Connection is read-only问题的产生原因与解决方法
2016-08-15 18:07
453 查看
WARN [org.hibernate.util.JDBCExceptionReporter] -<SQL Error: 0, SQLState: S1009>
ERROR [org.hibernate.util.JDBCExceptionReporter] -<Connection is read-only. Queries leading to datamodification are not allowed>
org.hibernate.exception.GenericJDBCException: could not executeupdate query
产生原因:
一般如果报了这个错,是项目中事务配置文件的问题。
<tx:advice id="txAdvice"transaction-manager="trans">
<tx:attributes>
<tx:method name="init*"/>
<tx:method name="insert*"/>
<tx:method name="add*"/>
<tx:method name="*"read-only="true"/>
</tx:attributes>
</tx:advice>
这里面规定了数据库操作函数必须要以以上字符串开头,否则的话就按照默认的配置,对数据库访问的权限为read-only。
一般来说一个数据库操作类XXService都是继承基类 DAO.
数据库操作类XXService中的方法在执行的时候,会和事务配置表中的进行对比,并赋给相应的权限。
解决办法:
解决方案有2种
1.规范命名
2.删除read-only="true",但是这种方法不推荐,因为有可能会出现一些你想不到的问题,或者是对服务器的性能造成影响。
ERROR [org.hibernate.util.JDBCExceptionReporter] -<Connection is read-only. Queries leading to datamodification are not allowed>
org.hibernate.exception.GenericJDBCException: could not executeupdate query
产生原因:
一般如果报了这个错,是项目中事务配置文件的问题。
<tx:advice id="txAdvice"transaction-manager="trans">
<tx:attributes>
<tx:method name="init*"/>
<tx:method name="insert*"/>
<tx:method name="add*"/>
<tx:method name="*"read-only="true"/>
</tx:attributes>
</tx:advice>
这里面规定了数据库操作函数必须要以以上字符串开头,否则的话就按照默认的配置,对数据库访问的权限为read-only。
一般来说一个数据库操作类XXService都是继承基类 DAO.
数据库操作类XXService中的方法在执行的时候,会和事务配置表中的进行对比,并赋给相应的权限。
解决办法:
解决方案有2种
1.规范命名
2.删除read-only="true",但是这种方法不推荐,因为有可能会出现一些你想不到的问题,或者是对服务器的性能造成影响。
相关文章推荐
- Connection is read-only问题的产生原因与解决方法
- ssh中Connection is read-only问题的产生原因与解决方法
- linux下mysql error #1036 - Table 'xxxx' is read only问题的解决方法
- Fedora11上安装bugzilla出现 max_allowed_packet is read-only问题的解决方法
- ssh中Connection is read-only问题的产生原因与解决方法
- ssh中Connection is read-only问题的产生原因与解决方法
- mysql的table is read only 解决方法
- 编写SqlHelper使用,在将ExecuteReader方法封装进而读取数据库中的数据时会产生Additional information: 阅读器关闭时尝试调用 Read 无效问题,解决方法与解释
- mysql做master/slave时当出现ERROR 1036 (HY000): Table is read only 的解决方法
- Java中long类型直接赋值出现The literal xxxxxxxxxx of type int is out of range 问题的原因和解决方法
- HttpURLConnection碰到连续302跳转的问题的原因及解决方法
- mysql中Table is read only的解决方法
- MySQL的MyISAM表出现Table XXX is read only问题的解决办法
- 解决read-only file system 问题方法
- HttpURLConnection碰到连续302跳转的问题的原因及解决方法
- mysql中Table is read only错误解决方法
- Unable to chmod ***: Read-only file system问题的解决方法
- Mysql数据库“Connection is read-only”问题
- mysql中Table is read only的解决方法小结
- Linux下MySql出现#1036 – Table ‘ ‘ is read only 错误解决方法