首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

错误记录

2012-09-06 
异常记录spring 环境下做一个保存操作时,抛出如下异常:org.springframework.dao.InvalidDataAccessApiUsag

异常记录
spring 环境下做一个保存操作时,抛出如下异常:

     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.

<!-- 配置事务特性 -->      

<tx:advice id="txAdviceBHO" transaction-manager="transactionManager">    <tx:attributes>       <tx:method name="save*" propagation="REQUIRED" />       <tx:method name="update*" propagation="REQUIRED" />       <tx:method name="delete*" propagation="REQUIRED" />       <tx:method name="*" read-only="true" propagation="NEVER"/>    </tx:attributes></tx:advice>


原因 在于配置事务时有错误,我调用的方法为orderSave,操作为保存数据,而在如下配置中针对此方法只能做读取操作,就出现了如上异常




热点排行