src/main/java/org/beigesoft/replicator/service/PrepareDbAfterGetCopyPostgresql.java
@Override
  public final void make(
    final Map<String, Object> pAddParams) throws Exception {
    int preparedEntitiesCount = 0;
    try {
      this.srvDatabase.setIsAutocommit(false);
      this.srvDatabase.
        setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED);
      this.srvDatabase.beginTransaction();
      for (Class<?> entityClass : this.classes) {
        if (APersistableBase.class.isAssignableFrom(entityClass)) {
          preparedEntitiesCount++;
          String queryMaxId = "select max(ITSID) as MAXID from "
            + entityClass.getSimpleName().toUpperCase() + ";";
          Integer maxId = this.srvDatabase
            .evalIntegerResult(queryMaxId, "MAXID");
          if (maxId != null) {
            maxId++;
            String querySec = "alter sequence " + entityClass.getSimpleName()
              .toUpperCase() + "_ITSID_SEQ restart with " + maxId + ";";
            this.srvDatabase.executeQuery(querySec);
          }
        }
      }
      this.srvDatabase.commitTransaction();
    } catch (Exception ex) {
      this.srvDatabase.rollBackTransaction();
      throw ex;
    } finally {
      this.srvDatabase.releaseResources();
    }
    this.factoryAppBeans.releaseBeans();
    Writer htmlWriter = (Writer) pAddParams.get("htmlWriter");
    if (htmlWriter != null) {
      htmlWriter.write("<h4>" + new Date().toString() + ", "
      + PrepareDbAfterGetCopyPostgresql.class.getSimpleName()
        + ", app-factory beans has released" + "</h4>");
    }
    this.logger.info(null, PrepareDbAfterGetCopyPostgresql.class,
      "Total sequence prepared: " + preparedEntitiesCount
        + ", app-factory beans has released");
  }
@Override
  public final void make(
    final Map<String, Object> pAddParams) throws Exception {
    int preparedEntitiesCount = 0;
    try {
      this.srvDatabase.setIsAutocommit(false);
      this.srvDatabase.
        setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED);
      this.srvDatabase.beginTransaction();
      for (Class<?> entityClass : this.classes) {
        if (APersistableBase.class.isAssignableFrom(entityClass)) {
          preparedEntitiesCount++;
          String queryMaxId = "select max(ITSID) as MAXID from "
            + entityClass.getSimpleName().toUpperCase() + ";";
          Integer maxId = this.srvDatabase
            .evalIntegerResult(queryMaxId, "MAXID");
          if (maxId != null) {
            maxId++;
            String querySec = "alter sequence " + entityClass.getSimpleName()
              .toUpperCase() + "_ITSID_SEQ restart with " + maxId + ";";
            this.srvDatabase.executeQuery(querySec);
          }
        }
      }
      this.srvDatabase.commitTransaction();
    } catch (Exception ex) {
      this.srvDatabase.rollBackTransaction();
      throw ex;
    } finally {
      this.srvDatabase.releaseResources();
    }
    this.factoryAppBeans.releaseBeans();
    Writer htmlWriter = (Writer) pAddParams.get("htmlWriter");
    if (htmlWriter != null) {
      htmlWriter.write("<h4>" + new Date().toString() + ", "
      + PrepareDbAfterGetCopyPostgresql.class.getSimpleName()
        + ", app-factory beans has released" + "</h4>");
    }
    this.logger.info(null, PrepareDbAfterGetCopyPostgresql.class,
      "Total sequence prepared: " + preparedEntitiesCount
        + ", app-factory beans has released");
  }
<p>It prepares database after import.</p>
@param pAddParams additional params
@throws Exception - an exception