src/main/java/org/beigesoft/replicator/service/DatabaseReaderSyncStdXml.java
@Override
  public final void readAndStoreEntities(final Map<String, Object> pAddParam,
    final Reader pReader) throws Exception {
    try {
      this.srvDatabase.setIsAutocommit(false);
      this.srvDatabase.
        setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED);
      this.srvDatabase.beginTransaction();
      while (this.utilXml.readUntilStart(pReader, "entity")) {
        Object entity = this.srvEntityReader.read(pAddParam, pReader);
        String nameEntitySync = this.mngSettings.lazClsSts(entity.getClass())
          .get("ISrvEntitySync");
        ISrvEntitySync srvEntitySync = this.srvEntitySyncMap
          .get(nameEntitySync);
        if (srvEntitySync == null) {
          throw new ExceptionWithCode(ExceptionWithCode
            .CONFIGURATION_MISTAKE, "There is no ISrvEntitySync "
              + nameEntitySync + " for " + entity.getClass());
        }
        boolean isNew = srvEntitySync.sync(pAddParam, entity);
        if (isNew) {
          this.srvOrm.insertEntity(pAddParam, entity);
        } else {
          this.srvOrm.updateEntity(pAddParam, entity);
        }
      }
      this.srvDatabase.commitTransaction();
    } catch (Exception ex) {
      this.srvDatabase.rollBackTransaction();
      throw ex;
    } finally {
      this.srvDatabase.releaseResources();
    }
  }
@Override
  public final void readAndStoreEntities(final Map<String, Object> pAddParam,
    final Reader pReader) throws Exception {
    try {
      this.srvDatabase.setIsAutocommit(false);
      this.srvDatabase.
        setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED);
      this.srvDatabase.beginTransaction();
      while (this.utilXml.readUntilStart(pReader, "entity")) {
        Object entity = this.srvEntityReader.read(pAddParam, pReader);
        String nameEntitySync = this.mngSettings.lazClsSts(entity.getClass())
          .get("ISrvEntitySync");
        ISrvEntitySync srvEntitySync = this.srvEntitySyncMap
          .get(nameEntitySync);
        if (srvEntitySync == null) {
          throw new ExceptionWithCode(ExceptionWithCode
            .CONFIGURATION_MISTAKE, "There is no ISrvEntitySync "
              + nameEntitySync + " for " + entity.getClass());
        }
        boolean isNew = srvEntitySync.sync(pAddParam, entity);
        if (isNew) {
          this.srvOrm.insertEntity(pAddParam, entity);
        } else {
          this.srvOrm.updateEntity(pAddParam, entity);
        }
      }
      this.srvDatabase.commitTransaction();
    } catch (Exception ex) {
      this.srvDatabase.rollBackTransaction();
      throw ex;
    } finally {
      this.srvDatabase.releaseResources();
    }
  }
<p>
Read entities from stream (by given reader) and synchronize them
into DB.
</p>
@param pAddParam additional params
@param pReader Reader
@throws Exception - an exception