Write operations are not allowed in read-only mode (FlushMode.MANUAL)错误的解决方法
2015-01-08 19:34
423 查看
异常: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.
直到DaoIpml.java 都是正确的,DaoIpml.java中的源码
@Override
public void addSourceIndustry(SourceIndustry sourceIndustry) {
this.getHibernateTemplate().saveOrUpdate(sourceIndustry);
}
在使用save()方法 保存数据时,一直无法保存。
火狐浏览器报错:
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.
解决方法:将createAdmin方法配置到spring的事件中管理,添加了以下的一条配置
<tx:method name="create*" propagation="REQUIRED"/>
具体spring事件配置如下:
<aop:config>
<aop:pointcut id="txServices"
expression="execution(* com.trig.service..*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="txServices" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="create*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
相关文章推荐
- Write operations are not allowed in read-only mode (FlushMode.MANUAL)错误解决的一种方法
- Write operations are not allowed in read-only mode (FlushMode.MANUAL)错误解决
- Write operations are not allowed in read-only mode (FlushMode.MANUAL): 解决方法
- Spring整合Hibernate错误日记2:Write operations are not allowed in read-only mode (FlushMode.MANUAL)
- 解决:Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into Flu
- 解决Spring4+Hibernate4遇到的 Write operations are not allowed in read-only mode (FlushMode.MANUAL)
- hibernate框架学习错误集锦-org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.MANUAL)
- 错误:Write operations are not allowed in read-only mode (FlushMode.MANUAL)
- Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushM
- Write operations are not allowed in read-only mode (FlushMode.MANUAL):
- Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn
- Write operations are not allowed in read-only mode (FlushMode.MANUAL):
- InvalidDataAccessApiUsageException 和 Write operations are not allowed in read-only mode 解决方法
- Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL)异常解决方法
- 使用Spring提供的Open Session In View而引起Write operations are not allowed in read-only mode (FlushMode.NEVER) 错误解决
- Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushM
- Write operations are not allowed in read-only mode (FlushMode.MANUAL)
- 解决Hibernate Write operations are not allowed in read-only mode的方法
- HTTP Status 500 - Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your S
- Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushM