Spring3 向数据库内插入数据出错
来源:互联网 发布:网络销售是什么工作 编辑:程序博客网 时间:2024/05/29 14:13
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:927)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:822)
javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:233)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:927)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:822)
javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:233)
org.springframework.web.filter.OncePerR
写操作在只读模式下是不允许的,将session设置为自动提交或者将只读标签在此事物中移除。
项目使用spring容器的事物管理策略,在xml配置文件中需设定好 方法(service层) 与 事物策略的对应关系。
查询操作可设置事物管理策略为只读,相应的修改添加删除等操作就不可以是只读了。
如图中的read-ony属性,默认是false,即默认情况下是不会开启只读了。
以上错误,只需将所用到的方法(service层)在spring的配置文件中配置一下即可。
0 0
- Spring3 向数据库内插入数据出错
- 从文本文件向数据库内插入数据(openfiledialog等控件)
- Asp.net 向数据库内存储图片(一)
- 向DropDownList插入数据
- 数据库内搜索问题
- 向数据库插入批量数据
- 批量向oracle插入数据
- 向数据库中插入数据:
- 2.向数据库插入数据
- 如何向视图插入数据
- 向Hbase插入数据代码
- java 向DB2插入数据
- PHP向数据库插入数据
- 程序返回插入数据库成功,但是数据库内却没有数据
- 一个数据库内两个表空间之间一个表的数据插入到另一个数据表
- SQL数据库内批量导入
- 数据库内连接、外连接
- 数据库内、外连接总结
- 黑马程序员——设计模式之单例设计模式
- lua 文件读写
- nm 参数详解
- solr搭建企业搜索平台,tomcat下
- Maximum Depth of Binary Tree
- Spring3 向数据库内插入数据出错
- Android sharedUserId研究记录
- adfasdf
- lame支持armv6 armv7 i386 armv7s arm64
- Android 用JDBC直连Mysql数据库
- toast提示控件使用(待写。。)
- Tomcat服务器配置
- solr搭建企业搜索平台,配置文件
- C/C++的转义字符