private void manageReference(
      DataRequest request, URI referenceId, NoContentResponse response, boolean delete)
      throws ODataApplicationException {
    UpdateResponse updateResponse = null;
    try {
      ReferenceUpdateSQLBuilder visitor =
          new ReferenceUpdateSQLBuilder(
              getClient().getMetadataStore(),
              request.getODataRequest().getRawBaseUri(),
              this.serviceMetadata,
              this.odata);
      visitor.visit(request.getUriInfo());

      Update update = visitor.updateReference(referenceId, this.prepared, delete);
      updateResponse = getClient().executeUpdate(update, visitor.getParameters());
    } catch (SQLException e) {
      throw new ODataApplicationException(
          e.getMessage(),
          HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(),
          Locale.getDefault(),
          e);
    }

    if (updateResponse != null && updateResponse.getUpdateCount() > 0) {
      response.writeNoContent();
    } else {
      response.writeNotModified();
    }
  }
 @Override
 public void upsertStreamProperty(
     DataRequest request, String entityETag, InputStream streamContent, NoContentResponse response)
     throws ODataLibraryException, ODataApplicationException {
   UpdateResponse updateResponse = null;
   EdmProperty edmProperty = request.getUriResourceProperty().getProperty();
   try {
     ODataSQLBuilder visitor =
         new ODataSQLBuilder(
             this.odata,
             getClient().getMetadataStore(),
             this.prepared,
             false,
             request.getODataRequest().getRawBaseUri(),
             this.serviceMetadata,
             this.nameGenerator);
     visitor.visit(request.getUriInfo());
     Update update = visitor.updateStreamProperty(edmProperty, streamContent);
     updateResponse = getClient().executeUpdate(update, visitor.getParameters());
   } catch (SQLException | TeiidException e) {
     throw new ODataApplicationException(
         e.getMessage(),
         HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(),
         Locale.getDefault(),
         e);
   }
   if (updateResponse != null && updateResponse.getUpdateCount() > 0) {
     response.writeNoContent();
   } else {
     response.writeNotModified();
   }
 }