code: @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
      public ResponseEntity<E> update(@PathVariable int id, HttpServletRequest request) {
  
          String errorPrefix = "Error updating "
              + getEntityClass().getSimpleName() + " with ID " + id + ": ";
  
          Reader reader = null;
  
          try {
              // read and parse the json request body
              reader = request.getReader();
              JsonNode jsonObject = objectMapper.readTree(reader);
  
              // validate json object
              if (jsonObject == null || !jsonObject.has("id")) {
                  LOG.error(errorPrefix
                      + "The JSON body is empty or has no 'id' property.");
                  return new ResponseEntity<E>(HttpStatus.BAD_REQUEST);
              }
  
              // assure that the path variable id equals the payload id
              final int payloadId = jsonObject.get("id").asInt();
              if (payloadId != id) {
                  LOG.error(errorPrefix + "Requested to update entity with ID "
                      + id + ", but payload ID is " + payloadId);
                  return new ResponseEntity<E>(HttpStatus.BAD_REQUEST);
              }
  
              // get the persisted entity
              E entity = service.findById(id);
  
              if (entity != null) {
                  // we call this transactional method (instead of save or update)
                  // to make sure that the possibly modified entity does not
                  // get persisted / synced unexpectedly by hibernate
                  // (due to FlushMode.AUTO) when another database-related
                  // interaction is triggered in the meantime (which could happen
                  // for example in a permission evaluation).
                  // In other words: Do not get an entity, modify it and save it
                  // in a non-transactional way (e.g. controller method), as
                  // a possible permission evaluation could trigger an unwanted
                  // persist action before the permission was evaluated.
                  entity = service.updatePartialWithJsonNode(entity, jsonObject, objectMapper);
                  return new ResponseEntity<E>(entity, HttpStatus.OK);
              }
              return new ResponseEntity<E>(HttpStatus.NOT_FOUND);
          } catch (Exception e) {
              LOG.error(errorPrefix + e.getMessage());
              return new ResponseEntity<E>(HttpStatus.NOT_FOUND);
          } finally {
              IOUtils.closeQuietly(reader);
          }
      }
docs: Updates an entity by id.
  
  @param id