Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is a spring transaction

Shulou Source: shulou.com Published: 2022-06-02 09:43:54 10月04日 Update

This article introduces the relevant knowledge of "what is spring transaction". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The inner methods modified by NESTED and REQUIRED are peripheral method transactions, and if the peripheral methods throw an exception, the transactions of both methods will be rolled back. But REQUIRED joins the peripheral method transaction, so it belongs to the same transaction as the peripheral transaction. Once the REQUIRED transaction throws an exception and is rolled back, the peripheral method transaction will also be rolled back. On the other hand, NESTED is a subtransaction of the peripheral method and has a separate save point, so the NESTED method throws an exception and is rolled back without affecting the transaction of the peripheral method.

Both NESTED and REQUIRES_NEW can roll back internal method transactions without affecting peripheral method transactions. But because the NESTED is a nested transaction, after the peripheral method is rolled back, the child transaction as the peripheral method transaction is also rolled back. While REQUIRES_NEW is realized by opening a new transaction, the internal transaction and the peripheral transaction are two transactions, and the rollback of the peripheral transaction will not affect the internal transaction.

This is the end of "what is spring transaction". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Transaction method influence content more knowledge practicality achievement next two dilemma reality situation article case editor website industry process high quality Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Microsoft Linux MySQL NVidia