@Transcational
-
@Transcational只有对public方法生效
-
@Transcational(readOnly=true)
`readOnly`而是将标志作为提示传播到底层JDBC驱动程序,以进行性能优化。
Spring在基础JPA提供程序上执行了一些优化
For example, when used with Hibernate, the flush mode is set to
NEVER
when you configure a transaction asreadOnly
, which causes Hibernate to skip dirty checks (a noticeable improvement on large object trees).意义:主要是让数据库放弃了 redo log日志的记录,提高效率
-
同一个类 中没有事务控制的方法调用另外一个@Transcational标记的方法,会让事务注解标记失效
-
事务的传播机制
- required default
- requires_new
- supports
- not_supported
- never
- nested
- mandatory
-
事务的隔离级别
-
读取未提交 ->丢失修改
-
读取已提交-> 脏读
-
可重复读 ->不可重复读
-
串行化 ->幻读
-