---
title: "认识事务 目录"
author: "seanwon"
date: "2010-08-20T15:29:12Z"
tags: []
categories: ["编程语言"]
slug: "untitled"
draft: false
lastmod: "2010-08-20T15:29:12Z"
id: 743296
url: "https://seanwon.iteye.com/blog/743296"
---

[![](http://dl.iteye.com/upload/attachment/296184/35238df8-744a-3b97-a65c-ddd261a9af18.jpg)  
1.      什么是事务... 3](http://seanwon.iteye.com/admin/blogs/#_Toc269391011)

[2.1        事务定义... 3](http://seanwon.iteye.com/admin/blogs/#_Toc269391012)

[2.2        事务场景... 3](http://seanwon.iteye.com/admin/blogs/#_Toc269391013)

[2.3        事务的工作原理... 4](http://seanwon.iteye.com/admin/blogs/#_Toc269391014)

[2.4        事务的必要条件（ACID）... 5](http://seanwon.iteye.com/admin/blogs/#_Toc269391015)

[2.5        事务隔离级别... 6](http://seanwon.iteye.com/admin/blogs/#_Toc269391016)

[2.6        事务隔离级别与锁... 11](http://seanwon.iteye.com/admin/blogs/#_Toc269391017)

[2.      事务类型... 12](http://seanwon.iteye.com/admin/blogs/#_Toc269391018)

[3.1        本地事务... 12](http://seanwon.iteye.com/admin/blogs/#_Toc269391019)

[3.2        分布式事务... 12](http://seanwon.iteye.com/admin/blogs/#_Toc269391020)

[2.2.1         JTA. 14](http://seanwon.iteye.com/admin/blogs/#_Toc269391021)

[2.2.2         JTS. 14](http://seanwon.iteye.com/admin/blogs/#_Toc269391022)

[2.2.3         XA. 17](http://seanwon.iteye.com/admin/blogs/#_Toc269391023)

[2.2.4         2PC. 18](http://seanwon.iteye.com/admin/blogs/#_Toc269391024)

[2.2.5         XA与2PC协议... 19](http://seanwon.iteye.com/admin/blogs/#_Toc269391025)

[2.2.6         实现方式分类... 20](http://seanwon.iteye.com/admin/blogs/#_Toc269391026)

[2.2.7         事务传播机制（Transaction Attributes）... 20](http://seanwon.iteye.com/admin/blogs/#_Toc269391027)

[3.      事务模型... 21](http://seanwon.iteye.com/admin/blogs/#_Toc269391028)

[3.1        本地事务模型... 21](http://seanwon.iteye.com/admin/blogs/#_Toc269391029)

[3.1.1         自动提交和连接管理... 22](http://seanwon.iteye.com/admin/blogs/#_Toc269391030)

[3.1.2         适用场景和限制... 23](http://seanwon.iteye.com/admin/blogs/#_Toc269391031)

[3.2        编程式事务模型... 23](http://seanwon.iteye.com/admin/blogs/#_Toc269391032)

[3.2.1         获取JTA UserTransaction引用... 24](http://seanwon.iteye.com/admin/blogs/#_Toc269391033)

[3.2.2         编程式事务陷阱... 24](http://seanwon.iteye.com/admin/blogs/#_Toc269391034)

[3.2.3         事务上下文问题... 25](http://seanwon.iteye.com/admin/blogs/#_Toc269391035)

[3.2.4         编程式事务适用场景... 26](http://seanwon.iteye.com/admin/blogs/#_Toc269391036)

[3.2.5         UserTransaction接口... 26](http://seanwon.iteye.com/admin/blogs/#_Toc269391037)

[3.3        声明式事务模型... 27](http://seanwon.iteye.com/admin/blogs/#_Toc269391038)

[3.3.1         指定事务属性... 28](http://seanwon.iteye.com/admin/blogs/#_Toc269391039)

[3.3.2         异常处理... 30](http://seanwon.iteye.com/admin/blogs/#_Toc269391040)

[3.3.3         EJB3.0. 30](http://seanwon.iteye.com/admin/blogs/#_Toc269391041)

[3.3.4         setRollbackOnly的替代方法... 31](http://seanwon.iteye.com/admin/blogs/#_Toc269391042)

[3.3.5         Required与Mandatory. 31](http://seanwon.iteye.com/admin/blogs/#_Toc269391043)

[3.3.6         TransactionManager接口... 31](http://seanwon.iteye.com/admin/blogs/#_Toc269391044)

[3.3.7         EJBContext接口... 32](http://seanwon.iteye.com/admin/blogs/#_Toc269391045)

[4.      事务设计模式... 32](http://seanwon.iteye.com/admin/blogs/#_Toc269391046)

[4.1        Client Owner Transaction设计模式... 32](http://seanwon.iteye.com/admin/blogs/#_Toc269391047)

[4.1.1         场景... 32](http://seanwon.iteye.com/admin/blogs/#_Toc269391048)

[4.1.2         解决方案... 32](http://seanwon.iteye.com/admin/blogs/#_Toc269391049)

[4.1.3         结论... 33](http://seanwon.iteye.com/admin/blogs/#_Toc269391050)

[4.1.4         实现... 33](http://seanwon.iteye.com/admin/blogs/#_Toc269391051)

[4.2        Domain Service Owner设计模式... 35](http://seanwon.iteye.com/admin/blogs/#_Toc269391052)

[4.2.1         场景... 35](http://seanwon.iteye.com/admin/blogs/#_Toc269391053)

[4.2.2         条件... 36](http://seanwon.iteye.com/admin/blogs/#_Toc269391054)

[4.2.3         解决方案... 36](http://seanwon.iteye.com/admin/blogs/#_Toc269391055)

[4.2.4         结论... 36](http://seanwon.iteye.com/admin/blogs/#_Toc269391056)

[4.2.5         实现... 37](http://seanwon.iteye.com/admin/blogs/#_Toc269391057)

[4.3        Server Delegate Owner 设计模式... 38](http://seanwon.iteye.com/admin/blogs/#_Toc269391058)

[4.3.1         场景... 39](http://seanwon.iteye.com/admin/blogs/#_Toc269391059)

[4.3.2         条件... 39](http://seanwon.iteye.com/admin/blogs/#_Toc269391060)

[4.3.3         解决方案... 40](http://seanwon.iteye.com/admin/blogs/#_Toc269391061)

[4.3.4         实现... 41](http://seanwon.iteye.com/admin/blogs/#_Toc269391062)

[5.      事务陷阱... 42](http://seanwon.iteye.com/admin/blogs/#_Toc269391063)