Transactions and unit of work
Most business operations result in addition/removal of, updates to database records. A business operation is considered successful only when all constituent database operations are committed to database successfully, among other things. Failure of even a single database operation signals the failure of the whole business operation. In this situation, all other successful database operations need to be reverted back. Most relational databases offer ability to bundle multiple database operations as one unit called transaction. Relational databases offer a guarantee that either all operations inside a transaction succeed or they all fail, leaving the data in a consistent state. This behavior is also described using ACID properties which stand for Atomic, Consistency, Isolation, and Durability. These properties guarantee that database transactions are processed in a reliable manner. Let's briefly understand what behavior these properties define:
- Atomicity:...