Book Image

Learning NHibernate 4

Book Image

Learning NHibernate 4

Overview of this book

Table of Contents (18 chapters)
Learning NHibernate 4
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Concurrency control


At the heart of it, concurrency control is about working out which of the two concurrent database operations win. NHibernate's concurrency control goes beyond that and offers prevention against mistakenly updating stale data. This mostly applies to update operations. Select, insert, and delete operations can happen concurrently without any problem. Before we look into this feature, let's take a moment to understand what kind of problems we can face in absence of concurrency control for update operations. Let's assume that our employee benefits management system has a feature where in HR staff can update personal details of the employees. In a rare situation, it may happen that two HR staff members open the personal details of the same employee and try to update two different fields on their profile. Let's say that the first staff member updates the employee's last name, whereas the second staff member updates the employee's mobile number. Following is the sequence of...