spring transaction事务
来源:互联网 发布:python 元组添加元素 编辑:程序博客网 时间:2024/06/06 03:57
1. transaction 事务 是什么?
事务是数据库中的一个执行单元,事务包含的操作动作,要么全部完成,要么完全不起作用。
2. transaction 事务 4个特性(ACID):
atomicity(原子性):事务是一个不可分割的执行单元,事务包含的操作动作,要么全部完成,要么完全不起作用。
consistency(一致性):事务完成时,所有的数据保持一致状态
isolation(隔离性):事务与其他事务应当隔离开来,可能存在许多事务处理相同的数据,导致数据损坏
durability(永久性):一旦事务提交,那么它对数据库中的数据的改变是永久性的。
3. transaction 事务作用?
保证数据的完整性和一致性。
4. spring中 事务管理(编程式事务管理和声明式事务管理):
编程式事务管理:分为2种方式:transactionTemplate、platformTransactionManager,需要额外的添加事务管理代码
声明式事务管理:它是将事务管理代码从业务方法中分离出来,spring 是通过 spring AOP 来支持声明式事务管理。
声明式事务管理 spring 官方示例:点击打开链接
@Transactional public void book(String... persons) { for (String person : persons) { logger.info("Booking " + person + " in a seat..."); jdbcTemplate.update("insert into BOOKINGS(FIRST_NAME) values (?)", person); } }
This method is tagged with @Transactional, meaning that any failure causes the entire operation to roll back to its previous state, and to re-throw the original exception. This means that none of the people will be added to BOOKINGS if one person fails to be added.
翻译:意味着,任何失败都将引起整个操作回滚到它之前的状态 并且 重新抛出原始异常,如果一个人添加失败,则没有人能被添加到BOOKINGS。
0 0
- spring transaction--事务架构
- spring transaction事务
- Spring transaction 事务 --Isolation & Progation
- Spring Transaction template 事务模板
- Spring transaction 事务 --Isolation & Progation
- Spring Transaction 分析事务属性
- spring@Transaction注解方式的事务
- Spring中Transaction事务配置方式
- spring transaction源码分析--事务架构
- spring transaction源码分析--事务架构
- 【Spring应用级学习】事务(transaction)
- spring transaction源码分析--事务架构
- Spring Transaction 分析事务属性(事务的基本概念、配置)
- Spring-tx声明式事务、@Transaction注解事务
- spring 嵌套事务(Nested Transaction) 和新建事务测试
- Transaction 事务
- Transaction-事务
- 事务Transaction
- 注解学习:实现简单的junit的@test注解
- lscpu
- 关于如何html如何读取后台缓存数据
- 一个学习js还可以的网站
- Lua中table的常用操作
- spring transaction事务
- SWIFT逻辑控制之循环结构
- eclipse中配置自动发布war包的步骤
- 串行网络、环形网络、星型网络
- Tanks Unity Tutorial
- Android弹出数字键盘的方法
- PostgreSQL自动备份批处理脚本
- 数据库事务中的隔离级别和锁+spring Transactional注解
- Activiti Modeler 5.22.0整合到Spring项目