public void saveOrUpdateBatch()

in src/main/java/com/google/gcs/sdrs/dao/impl/GenericDao.java [50:73]


  public void saveOrUpdateBatch(final List<T> entities) {
    Session session = null;
    Transaction transaction = null;
    try {
      session = openSession();
      transaction = session.beginTransaction();

      int i = 0;
      for (T entity : entities) {
        session.saveOrUpdate(entity);

        if (++i % 20 == 0) { // 20, same as the JDBC batch size
          // flush a batch of inserts and release memory:
          session.flush();
          session.clear();
        }
      }
      closeSessionWithTransaction(session, transaction);
    } catch (Exception e) {
      handleRuntimeException(e, transaction);
    } finally {
      closeSession(session);
    }
  }