【发布时间】:2017-05-09 07:10:29
【问题描述】:
在我的 java 应用程序中,多个线程一次更新同一行如何获得一致性结果?
例如
current row value count =0;
thread 1 updating it to count+1=1;
thread 2 updating at the same time count+1=2
but it should not happen like this
thread 1 updating it to count+1=1;
thread 2 updating at the same time count+1=1;
both threads should not catch the same value because both are running same time
how can we achieve this in jdbc hibernate , database ??
【问题讨论】:
-
单个数据库事务中每个线程更新多少个实体?
-
目前只有一个实体,但可能会有所不同
标签: java database multithreading hibernate concurrency