10:38:45,707 ERROR DefaultDispatcherErrorHandler:42 - Exception occurred during processing request: 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.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.
这是因为忘记了加注解@Transactional
本文介绍了一种在Spring框架中遇到的典型问题:在使用了readOnly属性的事务中执行写操作时引发的InvalidDataAccessApiUsageException异常。文章详细解释了错误发生的原因,并提供了两种解决方案:一是更改Session的FlushMode,二是移除事务定义中的'readOnly'标记。
1万+

被折叠的 条评论
为什么被折叠?



