Locking refers to actions taken to prevent data in a relational database from changing between the time it is read and the time that it is used. Your locking strategy can be either optimistic or pessimistic . Locking strategies Optimistic Optimistic locking assumes that multiple transactions can complete without affecting each other, and that therefore transactions can proceed without locking the data resources that they affect. Before committing, each transaction verifies that no other transaction has modified its data. If the check reveals conflicting modifications, the committing transaction rolls back [ 1 ] . Pessimistic Pessimistic locking assumes that concurrent transactions will conflict with each other, and requires resources to be locked after they are read and only unlocked after the application has finished using the data. Hibernate provides mechanisms for implementing both types of locking in your applications. Optimistic When your ...
This is my personal blog for the things that i do at work. I will post the interesting stuff that i do at my day to day work. It can work as a revision for me on the things that i have done.