title: Spring JPA Repository merge instead of save
body: <p>Could you help me with JPA Repository? During update request and using POST method - I need to save only fields that I sent into my POST body. But if I didn't write it into body JPA Repository set is as null (DB MySQL, default null). Please look the picture. 
  <a href="https://i.stack.imgur.com/kvUh0.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kvUh0.jpg" alt="enter image description here"></a></p>
  
  <p>If I don't send in bode airport code it becaming null after update. But it was "UAAA". How do I manage it? Thanks in advice!</p>
  
  <p>Model class cut:</p>
  
  <pre><code>@Entity 
  @SelectBeforeUpdate 
  @DynamicUpdate 
  @Table(name = "airports") 
  @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) 
  public class Airports {
  
       @Id
       @GeneratedValue(strategy = GenerationType.IDENTITY)
       private long id;
       private String airport; 
       private String code;
  </code></pre>
  
  <p>Controller class cut:</p>
  
  <pre><code>@RestController
  public class AirportsController {
      private AirportsRepository repository;
  
  
      public AirportsController(AirportsRepository repository) {
          this.repository = repository;
      }
  
      @PostMapping(value = "airports/update")
      public ResponseEntity updateAirportById(@RequestBody Airports airports) {
          Airports foundedById = repository.findOne(airports.getId());
          foundedById.setAirport(airports.getAirport());
          foundedById.setCode(airports.getCode());
          repository.save(foundedById);
  
          return new ResponseEntity(foundedById, HttpStatus.OK);
      }
  </code></pre>