title: How to handle partial updates to an Entity in Spring Boot
body: <p>We are doing partial update on an Entity using Spring Boot as follows, is there a more elegant way as if the Entity contains 50+ attributes then its really painful to handle</p>
  <pre><code>public Foo updateFoo(@PathVariable String id, @RequestBody Foo fooInput) {
      Foo foo = fooRepository.findById(id)
              .orElseThrow(() -&gt; new ResourceNotFoundException(&quot;Foo not found for this id: &quot; + id));
  
      if (fooInput.getCaption() != null) {
          foo.setCaption(fooInput.getCaption());
      }   
  
      if (fooInput.getBar() != null) {
          foo.setBar(fooInput.getBar());
      }   
      ...
  }  
  </code></pre>