In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will share with you about the key values of EJB transaction properties. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1 、 Required
If the client is running in an EJB transaction and a method in EJB is called, the method runs in the client's EJB transaction. If the client is not associated with an EJB transaction, the container starts a new EJB transaction before running the method. The Required property is suitable for most EJB transactions, and it is recommended that it be set to the default, at least during the development phase. EJB transaction properties are declarative and can be easily modified later.
2 、 RequiresNew
If the client is running in an EJB transaction and the method in EJB is called, the container will do the following:
(1) suspend client EJB transaction
(2) start a new EJB transaction
(3) delegate the call to the method
(4) after the method is executed, reply to the client EJB transaction
If the client is not associated with an EJB transaction, the container starts a new EJB transaction before running the method. If you ensure that the method always runs in a new EJB transaction, you should use the RequiresNew property in the EJB transaction property.
3 、 Mandatory
If the client is running in an EJB transaction and a method in EJB is called, the method runs in the client EJB transaction. If the client is not associated with an EJB transaction, the container throws a TransactionRequiredException. If the methods in EJB must use the client's EJB transaction, you should use the Mandatory attribute in the EJB transaction property.
4 、 NotSupported
If the client runs in an EJB transaction and calls a method in EJB, the container suspends the client-side EJB transaction and replies to the client-side EJB transaction after the method invocation ends. If the client is not associated with an EJB transaction, the container does not start the EJB transaction before running the method. For methods that do not require EJB transactions, you can consider this attribute. EJB transactions require some overhead, and the NotSupported attribute in the EJB transaction attribute can improve performance.
5 、 Supports
If the client is running in an EJB transaction and a method in EJB is called, the method runs in the client's EJB transaction. If the client is not associated with an EJB transaction, the container does not start a new EJB transaction before running the method.
6 、 Never
If the client is running in an EJB transaction and a method in EJB is called, the container throws a RemoteException exception. If the client is not associated with an EJB transaction, the container does not start a new EJB transaction before running the method.
Thank you for reading! This is the end of this article on "what are the key values of EJB transaction attributes". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.