InvalidDataAccessApiUsageException SpringMVC Spring Hibernate 整合

来源:互联网 发布:sublimetext3 python 编辑:程序博客网 时间:2024/06/06 01:08
严重: Servlet.service() for servlet [springMVC] in context with path [/ssMVCh] threw exception [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.] with root cause

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.


听说SpringMVC和Spring 是无缝整合的,,,然后 springMVC-servlet.xml 和 applicationContext.xml 中都配置扫描,,然后扫描的包又是重复的,,然后就是两个bean工厂,,,然后异常,,,无缝整合,说说而已吧!

So........两个.xml文件中的<context:component-scan base-package="com..........." />     扫描的包是不能重复的!


如果采用web.xml中配置filter  的方式来解决该异常,又会产生一个你终身难忘的传说中的异常!