异常积累:org.springframework.dao.InvalidDataAccessApiUsageException Write operations are not allowed in
2016-11-06 21:18
543 查看
这种异常就是事务没有开启
1、
转载:文章来源:http://lucky16.iteye.com/blog/673903
2、@Transactional放在service层
1、
转载:文章来源:http://lucky16.iteye.com/blog/673903
此异常是由于Spring提供的Open Session In View而引起的。 开启OpenSessionInViewFilter这个过滤器的时候FlushMode就已经被默认设置为了MANUAL,如果FlushMode是MANUAL或NEVEL,在操作过程中 hibernate会将事务设置为readonly,所以在增加、删除或修改操作过程中会出现该错误 <filter> <filter-name>hibernateFilter</filter-name> <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> <init-param> <param-name>flushMode</param-name> <param-value>AUTO</param-value> </init-param> <init-param> <param-name>singleSession</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>hibernateFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
2、@Transactional放在service层
相关文章推荐
- 异常积累:org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in
- 异常积累:org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in
- hibernate框架学习错误集锦-org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.MANUAL)
- org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read
- org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read
- [spring]:org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode
- org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read
- org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read
- org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read
- org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read
- org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read
- org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in r...
- org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode
- org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER)
- [spring]:org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode
- org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read
- 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' mar
- org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed
- 异常:InvalidDataAccessApiUsageException:Write operations are not allowed in read-only mode
- InvalidDataAccessApiUsageException:Write operations are not allowed in read-only mode (FlushMode.NEV