title: How to keep DB data consistance with Spring data jpa
body: <p>I have an application running running in murtiple instance, core source code as below:</p>
  <pre><code>@Transactional(isolation = Isolation.REPEATABLE_READ)
  public void decrease() {
      Optional&lt;Stock&gt; stockOptional = stockRepository.findById(1L);
      if (stockOptional.isPresent()) {
          Stock stock = stockOptional.get();
          stock.setCount(stock.getCount() + 1);
          stockOptional.save(dbStock);
      }
  }
  </code></pre>
  <p>It works in single instance, but it doesn't work in murtiple case, for example, there are two instances running in the same time, each of them call this function for 1000 times, so fianlly expect the count = 2000, but finally database shows it just 1xxx.</p>
  <p>Any solutions here?</p>