code: @Override
      protected void onPersist(EntityMetadata entityMetadata, Object entity, Object id, List<RelationHolder> rlHolders)
      {
          HttpResponse response = null;
          try
          {
              JsonObject object = CouchDBObjectMapper.getJsonOfEntity(entityMetadata, entity, id, rlHolders,
                      kunderaMetadata);
  
              String _id = object.get("_id").getAsString();
  
              URI uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(),
                      CouchDBConstants.URL_SEPARATOR + entityMetadata.getSchema().toLowerCase()
                              + CouchDBConstants.URL_SEPARATOR + _id, null, null);
  
              HttpPut put = new HttpPut(uri);
  
              StringEntity stringEntity = null;
  
              if (isUpdate)
              {
                  HttpGet get = new HttpGet(uri);
                  get.addHeader("Accept", "application/json");
                  response = httpClient.execute(httpHost, get, CouchDBUtils.getContext(httpHost));
  
                  try
                  {
                      InputStream content = response.getEntity().getContent();
                      Reader reader = new InputStreamReader(content);
                      JsonObject jsonObject = gson.fromJson(reader, JsonObject.class);
                      JsonElement rev = jsonObject.get("_rev");
                      object.add("_rev", rev);
                  }
                  finally
                  {
                      closeContent(response);
                  }
              }
              object.addProperty("_id", entityMetadata.getTableName() + id);
              stringEntity = new StringEntity(object.toString(), Constants.CHARSET_UTF8);
              stringEntity.setContentType("application/json");
              put.setEntity(stringEntity);
  
              response = httpClient.execute(httpHost, put, CouchDBUtils.getContext(httpHost));
  
          }
          catch (Exception e)
          {
              log.error("Error while persisting entity with id {}, caused by {}. ", id, e);
              throw new KunderaException(e);
          }
          finally
          {
              closeContent(response);
          }
      }
docs: /*
  (non-Javadoc)
  
  @see
  com.impetus.kundera.client.ClientBase#onPersist(com.impetus.kundera.metadata
  .model.EntityMetadata, java.lang.Object, java.lang.Object,
  java.util.List)