src/main/java/org/beigesoft/replicator/service/DatabaseReaderIdenticalXml.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);
        this.srvOrm.insertEntity(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);
        this.srvOrm.insertEntity(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 ) ; this . srvOrm . insertEntity ( 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 insert them
into DB with no changes. DB must be emptied before coping.
</p>
@param pAddParam additional params
@param pReader Reader
@throws Exception - an exception
<p > Read entities from stream ( by given reader ) and insert them into DB with no changes . DB must be emptied before coping . < / p >