private List<String> performUpdateRelational(
      QName ftName, List<ParsedPropertyReplacement> replacementProps, IdFilter filter)
      throws FeatureStoreException, FilterEvaluationException {

    FeatureTypeMapping ftMapping = schema.getFtMapping(ftName);
    FIDMapping fidMapping = ftMapping.getFidMapping();

    int updated = 0;
    PreparedStatement stmt = null;
    try {
      String sql =
          createRelationalUpdateStatement(
              ftMapping, fidMapping, replacementProps, filter.getSelectedIds());

      if (sql != null) {
        LOG.debug("Update: " + sql);
        stmt = conn.prepareStatement(sql.toString());
        setRelationalUpdateValues(replacementProps, ftMapping, stmt, filter, fidMapping);
        int[] updates = stmt.executeBatch();
        for (int noUpdated : updates) {
          updated += noUpdated;
        }
      }
    } catch (SQLException e) {
      JDBCUtils.log(e, LOG);
      throw new FeatureStoreException(JDBCUtils.getMessage(e), e);
    } finally {
      JDBCUtils.close(stmt);
    }
    LOG.debug("Updated {} features.", updated);
    return new ArrayList<String>(filter.getMatchingIds());
  }
  private void setRelationalUpdateValues(
      List<ParsedPropertyReplacement> replacementProps,
      FeatureTypeMapping ftMapping,
      PreparedStatement stmt,
      IdFilter filter,
      FIDMapping fidMapping)
      throws SQLException {
    int i = 1;

    for (ParsedPropertyReplacement replacement : replacementProps) {
      Property replacementProp = replacement.getNewValue();
      QName propName = replacementProp.getType().getName();
      Mapping mapping = ftMapping.getMapping(propName);
      if (mapping != null) {
        if (mapping.getJoinedTable() != null && !mapping.getJoinedTable().isEmpty()) {
          continue;
        }

        Object value = replacementProp.getValue();
        if (value != null) {
          ParticleConverter<TypedObjectNode> converter =
              (ParticleConverter<TypedObjectNode>) fs.getConverter(mapping);
          if (mapping instanceof PrimitiveMapping) {
            MappingExpression me = ((PrimitiveMapping) mapping).getMapping();
            if (!(me instanceof DBField)) {
              continue;
            }
            converter.setParticle(stmt, (PrimitiveValue) value, i++);
          } else if (mapping instanceof GeometryMapping) {
            MappingExpression me = ((GeometryMapping) mapping).getMapping();
            if (!(me instanceof DBField)) {
              continue;
            }
            converter.setParticle(stmt, (Geometry) value, i++);
          }
        } else {
          stmt.setObject(i++, null);
        }
      }
    }

    for (String id : filter.getMatchingIds()) {
      IdAnalysis analysis = schema.analyzeId(id);
      int j = i;
      for (String fidKernel : analysis.getIdKernels()) {
        PrimitiveValue value =
            new PrimitiveValue(fidKernel, new PrimitiveType(fidMapping.getColumnType()));
        Object sqlValue = SQLValueMangler.internalToSQL(value);
        stmt.setObject(j++, sqlValue);
      }
      stmt.addBatch();
    }
  }