1) PROPAGATION_REQUIRED - to support the current transaction, if does not exist to create a new one. This is the most common choice.
2) PROPAGATION_SUPPORTS - to support the current transaction, if there is no use of services.
3) PROPAGATION_MANDATORY - to support the current transaction, if does not exist throw an exception.
4) PROPAGATION_REQUIRES_NEW - to create a new transaction, and suspend the current transaction (if it exists).
5) PROPAGATION_NOT_SUPPORTED - do not use services, and suspend the current transaction (if it exists).
6) PROPAGATION_NEVER - do not use matters, if the current transaction will throw an exception exists.
7) PROPAGATION_NESTED - if the current exists, as embedded in matters regarding the implementation of transaction, or with PROPAGATION_REQUIRED similar.
1) PROPAGATION_REQUIRES_NEW and PROPAGATION_NESTED
PROPAGATION_REQUIRES_NEW start a new, does not depend on the environment of the "internal" affairs. This transaction will be fully commited or rolled back instead of relying on external affairs, the scope of its own isolation, their locks, and so on. When the internal affairs of the beginning executed, the external affairs will be suspended, the House Affairs, at the end of the external affairs will continue.
On the other hand, PROPAGATION_NESTED start a "nested" transaction, which is already existing services a real child transaction. Sets of potential transaction started, it will get a savepoint. If the nested transaction fails, we will roll back to this savepoint. submarine sets affairs are part of external affairs, only the external affairs after the end of it will be presented. Savepoint need the latest JDBC specification to support. JDBC3?
Thus, PROPAGATION_REQUIRES_NEW and PROPAGATION_NESTED the biggest difference is that, PROPAGATION_REQUIRES_NEW is a completely new transaction, while the PROPAGATION_NESTED is the External Affairs sub-transaction, if the external affairs commit, nested transaction will also be commit, this rule also applies to roll back .
2) Required and mandatory transaction attribute
Two kinds of support transaction context. If you call when there is no difference between the transaction context, Required to be launching a new business. The mandatory exception to be thrown.
Deep-seated differences based on the following rules:
With the exception of the stateful session bean, the method that starts a transaction must be the same method that terminates the transaction.
Required services can not be sure whether it is because in this method to start or come in from outside the pass, and therefore do not know whether to do this treatment rollback when an exception occurs. The Mandatory to confirm matters are imported from the outside, so know they do not need to deal with this logic.
Related Posts of Transaction Attribute
Super Medium ejb hate. . . . . . . . . . . . . . . . . . . ================================================ To configure a Message Driven Bean in a different application server parameters are not the same. Currently only passed the test jboss. Message Dri
1, JDBC is a included in the J2SE and J2EE platform API, you have access to a variety of data sources, in particular, are so typical as Oracle relational database management system. Sun Microsystems Inc. in January 1997 the introduction of JDBC techn ...
Today, the use of hibernate in the company encountered a troublesome problem, the use of hibernate when the primary key generation strategy set sequence, but always reported in the implementation could not get next sequence value of the error, then o ...
hibernate lock mechanism 1. Pessimistic lock It refers to the modification of data by outsiders hold a conservative attitude. The assumption that at any time access to data, may also have another client to access the same data, in order to maintain t ...
First, Appfuse brief introduction Matt Raible are Appfuse developed a guiding entry-level J2EE framework, how to integrate its popular Spring, Hibernate, ibatis, struts, Xdcolet, junit, etc. give the basic framework of the model, the latest version 1.7 is
[Problem] Now, in the development of the so-called multi-storey JavaEE applications, data persistence layer is always essential, and "Automatic" of ORM - Hibernate, and "all-manual-type" of SqlMap - IBatis, equivalent data are Per ...
The use of hibernate, implementation of data persistence. Has the following several processes. One configuration database connection information. Hibernate.config 2 configuration mapping. 3 use: the use of the process are the following steps: 3.1: Ge ...
The origin of ideas are pretty long history of reasons: [Use iBATIS history] The use of iBATIS has been a long time, the system is to use the CRUD template tool to generate the code, although there are tools to generate, but looked at a lot of CRUD the Sq
hibernate Lazy strategy can be used in: <class> tag, it can be true / false Tags can <PROPERTY> values true / false type of necessary tools to enhance <set> <list> can tag values true / false / extra <many-to-one> <on ...