title: Spring boot CrudRepo Save() method is not merging the existing entry, but it's replacing
body: <p>I am using Spring boot with Mysql. Whenever I call save method from the CrudRepository, it replaces the entity from the table. I want it to merge the new entity in the existing entity in table.</p>
  
  <p>What am I doing wrong here?</p>
  
  <p>eg. Entry in DB:  id=12345, firstName=foo, lastName=bar</p>
  
  <p>Calling save with new Entity: id=12345, firstName=doe</p>
  
  <p>After the save operation, db has, id=12345, firstName=doe, <strong>lastName=null</strong></p>
  
  <p>My entity class:</p>
  
  <pre><code>@Data
  @AllArgsConstructor
  @NoArgsConstructor
  @Builder
  @Entity
  
  public class Branch {
      @Id
      @Column(name = "id")
      private String id;
  
      @Column(name = "name")
      private String name;
  
      @Column(name = "address")
      private String address;
  
      @Column(name = "latitude")
      private String latitude;
  
      @Column(name = "longitude")
      private String longitude;
  
      @Column(name = "email")
      private String email;
  
      @Column(name = "phone")
      private String phone;
  
      @Enumerated(EnumType.STRING)
      private BranchType branchType;
  }
  </code></pre>
  
  <p>My Repo:</p>
  
  <pre><code>public interface BranchRepo extends CrudRepository&lt;Branch, String&gt; {
  
  }
  </code></pre>
  
  <p>application.properties</p>
  
  <pre><code>spring.jpa.hibernate.ddl-auto=update
  spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
  spring.datasource.url=jdbc:mysql://mysql-url
  spring.datasource.username=user-name-here
  spring.datasource.password=password-name-here
  spring.jpa.show-sql = true
  spring.datasource.testWhileIdle = true
  spring.datasource.validationQuery = SELECT 1
  spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.Defau‌​ltNamingStrategy
  spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
  spring.jpa.properties.hibernate.use_sql_comments=true 
  spring.jpa.properties.hibernate.format_sql=true
  spring.jpa.properties.hibernate.type=trace
  </code></pre>