@Override
  public void build() {
    final Session session = sessionProvider.getSession();

    final String MOTORS_QUERY =
        ""
            + "update Motor m set m.onSite = true where m.id in (\n"
            + "select m.Id from \n"
            + "Motor m\n"
            + "left outer join FiltersAndMotors fam on fam.motorId = m.id\n"
            + "left outer join Filter f on f.id = fam.filterId\n"
            + "where f.onSite = true)";
    executeQuery(session, MOTORS_QUERY);

    final String SERIA_QUERY =
        ""
            + "update Seria s set s.onSite = true where s.id in (\n"
            + "\tselect distinct(m.seriaId) from Motor m where m.onSite = true)";
    executeQuery(session, SERIA_QUERY);

    final String MANUFACTOR_QUERY =
        ""
            + "update Manufactor m set m.onSite = true where m.id in (\n"
            + "\tselect distinct(s.manufactorId) from Seria s where s.onSite = true)";
    executeQuery(session, MANUFACTOR_QUERY);

    final String VECHICLE_TYPE_QUERY =
        ""
            + "update VechicleType vt set vt.onSite = true where vt.id in (\n"
            + "\tselect distinct(m.vechicleTypeId) from Manufactor m where m.onSite = true)";
    executeQuery(session, VECHICLE_TYPE_QUERY);
  }
Exemplo n.º 2
0
 /** Запуск процессов по обновлению БД каталога */
 public void updateDB() {
   downloadDB();
   sessionProvider.close();
   dearchiveDB();
   updateState = getINFO_FOR_RELOAD();
   moveDB();
 }