title: Hibernate Batch Operation performance
body: <p>I have around 5000 records to update. I am trying to measure performance of the operation. It starts with around 100 ms but after every thousand updates operation time increases around 80 ms. Why is it slowing down? JVM?</p>
  
  <pre><code>StatelessSession session = dao.getStatelessSession();
  Transaction transaction = session.beginTransaction();
  try {
      List&lt;Entity&gt; list = dao.findAll();
      int counter = 0;
      for (Entity each : list) {
          final Date startTime = Clock.getTime();
          webService.execute(each);
          session.update(each);
          counter += 1;
          final Date endTime = Clock.getTime();
          LOGGER.info("***** " + getMilliSecondsDifference(startTime, endTime) + " for count: " + counter + "*****");
      }
  } catch (Exception e) {
      LOGGER.info("***** Exception occured : ", e);
  } finally {
      transaction.commit();
      session.close();
  }
  </code></pre>