尽管@Transactional的readOnly = true,但仍会插入Oracle 11g

问题描述 投票:0回答:1

我通过Spring配置文件注入的hibernateSessionFactory LocalSessionFactoryBean在Oracle 11g中插入值。 DAO类的插入方法有@Transactional(propagation = Propagation.REQUIRED,readOnly = true)。用于插入的方法是org.hibernate.Session.persist和flush为什么插入发生虽然事务的readOnly = true?

在此先感谢Kakoli

spring oracle hibernate
1个回答
2
投票

直接从the javadoc

public abstract boolean readOnly

如果事务是只读的,则为true。默认为false。

这仅仅是实际事务子系统的提示;它不一定会导致写访问尝试失败。当被要求进行只读事务时,不能解释只读提示的事务管理器不会抛出异常。

© www.soinside.com 2019 - 2024. All rights reserved.