Write operations are not allowed in read-only mode (FlushMode.MANUAL)

来源:互联网 发布:知乎如何修改问题 编辑:程序博客网 时间:2024/05/18 14:28

Hibernate使用过程中出现此类错误:Write operations are not allowed in read-only mode (FlushMode.MANUAL)

解决办法:

检查你的事务配置中的方法前缀是否和你现在使用的方法前缀一致,如果一致,需要修改你使用的方法前缀。

例如:

事务配置:

        <tx:attributes>
            <tx:method name="insert*" rollback-for="Exception" />
            <tx:method name="update*" rollback-for="Exception" />
            <tx:method name="delete*" rollback-for="Exception" />
            <tx:method name="get*" read-only="true" />
            <tx:method name="*" />
        </tx:attributes>

方法:getProductPackId 建议修改前缀xxxProductPackId 主要是看你的事务配置哪一层了

0 0
原创粉丝点击