I recently read mastering EJB ( 3rd , we can see the CMT section, which introduces the transaction attributes of declarative transaction management. I feel that it is really easy to understand and can be excerpted as follows:
Common EJB CMT6Type attribute:Required, requiresnew, supports, mandatory, notsupported, never.
COM +Remember that5Type:MandatoryOther than that5.
The control granularity of these attributes can reach the method level, meaning as follows:
[1] required:
Must run in transactions. If a transaction is already running, it is involved; otherwise, a new transaction is created.
[2] requiresnes:
Always start new transactions.
[3] supports:
The transaction that follows the client. If a transaction is running, it is involved; otherwise, it is not required to run in the transaction.
[4] mandatory:
The client must start the transaction; otherwise, an exception is thrown to the client. (This propertyCOM +Not in)
[5] notsupported:
Will not participate in the transaction, regardless of whether the client starts the transaction.
[6] Never:
Cannot participate in the transaction. If the client has started the transaction, an exception is thrown to the client.
Finally, an example table is provided to express the above concepts easily:
Transaction attributes |
Client transactions |
Transactions of components marking Properties |
Required |
None |
T1 |
T2 |
T1 |
Requiresnew |
None |
T1 |
T2 |
T2 |
Supports |
None |
T1 |
None |
T1 |
Mandatory |
None |
T1 |
Exception |
T1 |
Notsupported |
None |
T1 |
None |
None |
Never |
None |
T1 |
None |
Exception |
For more information about transaction isolation, see what I wrote.Article:
Http://interma.cnblogs.com/archive/2005/12/25/304472.html
Finally, it's irrelevant, even though everyone is shoutingWithout EJB,WithoutejbHoweverEJBAt least I feelEJB(Goal) is really beautiful.