Lock and Concurrency in JPA

原创
2017/05/15 14:08
阅读数 11

There are tow locking ways: optimistic and pessimistic locking.

Optimistic locking applies the following case:

there are infrequenct conflicts between concurrrent transactions that mean they are not often trying to read and change the same data at the same time. 

 

Pessimistic locking is suitabe for the case:

The transactions will collide frequently.  In pessimistic locking, when a transaction reads the data, it will lock it. At meantime,  another transaction cannot change the data until the first one commits its read.

展开阅读全文
打赏
0
0 收藏
分享

作者的其它热门文章

加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部