Introduction to declarative transaction management transaction attributes (applicable to COM +/ejb cmt)

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.