Declarative transactions and programmatic transactions

Source: Internet
Author: User

Declarative transactions: Configure transactions in a configuration file, invoke spring's transactions through beans, and do not require code-based transaction management in the program, such as Commit,backroll.

Programmatic transactions: You need to include the logic of handling transactions in your code, and you may need to display the methods in your code that call BeginTransaction (), commit (), rollback (), such as transactions that are required to execute a method, You need to open the transaction at the start of the A method, after processing. At the end of the method, the transaction is closed.

Transactions are designed to ensure the consistency and integrity of the data and to ensure that the entire operation is atomic (that is, indivisible), that the transaction is either all executed, or that it is not executed at all. If all the child transactions of a transaction are committed successfully, all database operations are committed, the database state is transformed, and if there is a child transaction failure, the database operations of the other child transactions are rolled back, that is, the database returns to the state before the transaction execution, and no state transitions occur. The same is true for spring or XXX transactions.

Declarative transactions and programmatic transactions

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.