---
title: "说说ejb的事务传播机制"
author: "x_root"
date: "2011-05-13T11:18:53Z"
tags: ["EJB"]
categories: ["企业架构"]
slug: "ejb"
draft: false
lastmod: "2011-05-13T11:19:11Z"
id: 1042122
url: "https://alfoo.iteye.com/blog/1042122"
---

说说ejb的事务传播机制
1、MANDATORY
Support a current transaction; throw an exception if no current transaction exists.
就是说支持当前的事务，如果当前没有事务，则会抛出一个异常；

2、REQUIRED
Support a current transaction; create a new one if none exists.
支持当前事务，如果当前没有事务，则创建一个新的事务；

3、REQUIRES_NEW
Create a new transaction, suspending the current transaction if one exists.
支持当前事务，如果当前有事务，则挂起当前事务，并创建一个新的事务；

4、SUPPORTS
Support a current transaction; execute non-transactionally if none exists.
支持当前事务，如果当前事务不存在，则以非事务的方式运行；

5、NOT_SUPPORTED
Do not support a current transaction; rather always execute non-transactionally.
不支持当前事务，总是以非事务的方式运行；

6、NEVER
Do not support a current transaction; throw an exception if a current transaction
不支持当前事务，如果当前存在事务，则抛出异常；