Introduction to spring propagation characteristics and isolation levels

Source: Internet
Author: User
Spring's transaction needs to be set to the business method (transaction boundary defined to the façade class), not to DAO

3. Understand several communication characteristics of transaction
1. Propagation_required: If a transaction exists, the current transaction is supported. Open if there is no transaction
2. Propagation_supports: If there is a transaction, the current transaction is supported. If there is no transaction, the execution of the non-transaction
3. Propagation_mandatory: If a transaction already exists, the current transaction is supported. If there is no active transaction, an exception is thrown.
4. Propagation_requires_new: Always open a new transaction. If a transaction already exists, the transaction that exists is suspended.
5. Propagation_not_supported: Always executes in a non transactional manner and suspends any existing transactions.
6. Propagation_never: Always execute in a non transactional manner, throw an exception if there is an active transaction
7. propagation_nested: If an active transaction exists, it is run in a nested transaction. If there is no active transaction,
Then press Transactiondefinition.propagation_required property to perform

4. Isolation level of spring transaction
1. Isolation_default: This is a platfromtransactionmanager default isolation level that uses the default transaction isolation level of the database.
The other four levels of isolation from JDBC correspond to
2. Isolation_read_uncommitted: This is the lowest isolation level for a transaction, which allows an external transaction to see uncommitted data for this transaction.
This isolation level produces dirty reads, no repeat reads, and Phantom reads.
3. isolation_read_committed: Ensure that a transaction modified by the data submitted before being read by another transaction. Another transaction cannot read data that is not committed by the transaction
4. Isolation_repeatable_read: This transaction isolation level prevents dirty reads and cannot be read repeatedly. However, Phantom reads may occur.
In addition to ensuring that one transaction cannot read data that is not committed by another transaction, it also ensures that the following conditions are avoided (non-repeatable reads).
5. Isolation_serializable This is the highest cost but the most reliable level of transaction isolation. Transactions are processed for sequential execution.
In addition to preventing dirty reading, it is not repeatable to read, but also avoid phantom reading.

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.