Optimistic concurrency control https://en.wikipedia.org/wiki/Optimistic_concurrency_control Optimistic concurrency control (OCC) is a concurrency control method applied to transactional systems such as relational database management systems and softw…
如果需要保证数据访问的排它性,则需对目标数据加"锁",使其无法被其它程序修改 一,悲观锁 对数据被外界(包括本系统当前的其它事务和来自外部系统的事务处理)修改持保守态度,通过数据库提供的锁机制实现 最常用的,是对查询进行加锁(LockMode.UPGRADE和LockMode.UPGRADE_NOWAIT): public class Test { public static void main(String[] args) { Configuration conf = new Con…