事务引发的 read-only mode (FlushMode.NEVER)

在执行添加、删除、修改方法时出现了如下错误:
Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition
解决办法:
一、在Service层的这些方法上添加 [Spring.Transaction.Interceptor.Transaction]
二、在Service层的配置文件中从事务继承过来,例如:
<property name="Target">
        <object type="JYLink.Web.Enterprise.Service.Implement.SystemMenusManager, JYLink.Web.Enterprise.Service">
        <property name="CurrentDao" ref="Dao.SystemMenus"/>
        </object>
</property>
相关文章
相关标签/搜索