ACID means atomicity, consistency, isolation, and durability. Changes within a transaction commit together or roll back together on failure.
The demo transfers 20 from A to B. If an error occurs between the updates, both balances return to their original values. Long-running transactions can increase lock and version-management costs.
When to use
Use a transaction when multiple changes, such as a transfer or stock decrement, must succeed together.