Previous lesson content
We insert two identical pieces of data and update two pieces of data separately, both with transactional functions, the code is as follows:
We make the first transaction able to execute the business logic code normally; We deliberately throw exceptions in the second transaction to see if it can be rolled back normally.
The test result shows that transaction 1 has no abnormalities and the update is successful. Transaction 2, throw an exception, fail to update, and roll back.
Source code download:
Tourists, if you want to see the hidden content of this post, please Reply
|