Alibaba cloud Q & A 2022-02-13 09:04:46 阅读数:256
spring What are the transaction characteristics of ？
⑴ Atomicity （Atomicity） Atomicity refers to the success of all operations contained in a transaction , Either all failures roll back , This is the same concept as the function of transaction introduced in the previous two blogs , Therefore, if the transaction operation succeeds, it must be fully applied to the database , If the operation fails, there will be no impact on the database . ⑵ Uniformity （Consistency） Consistency refers to the fact that a transaction must transform a database from one consistency state to another , That is to say, a transaction must be in a consistent state before and after execution . Take money transfer , Suppose the user A And the user B The sum of the two is 5000, So no matter A and B How to transfer money between banks , Transfer several times , After the transaction, the sum of money of the two users should be 5000, This is the consistency of transactions . ⑶ Isolation, （Isolation） Isolation is when multiple users access the database concurrently , For example, when operating the same table , A transaction opened by a database for each user , It cannot be interfered by the operation of other transactions , Multiple concurrent transactions should be isolated from each other . That is to achieve such an effect ： For any two concurrent transactions T1 and T2, In the transaction T1 It seems ,T2 Either in T1 It's over before it starts , Either in T1 It's not until it's over , In this way, each transaction does not feel that other transactions are executing concurrently . ⑷ persistence （Durability） Persistence means that once a transaction is committed , So the change to the data in the database is permanent , Even in the case of database system failure, the transaction commit operation will not be lost .
copyright：author[Alibaba cloud Q & A]，Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130904447689.html