title: Spring hibernate CrudRepository make the save method update based on a unique constraint
body: <p>I understand by default that the <code>CrudRepository.save</code> method inserts and updates based on a primary key.</p>
  
  <p>Consider the following entity</p>
  
  <pre><code>@Entity
  public class BookEntity {
      @Id
      @Column(name = "id")
      @GeneratedValue(strategy=GenerationType.AUTO)
      private int id;
  
      @Basic
      @Column(name = "isbn", unique = true)
      private String isbn;
  
      @Basic
      @Column(name = "title")
      private String title;
  
      @Basic
      @Column(name = "author")
      private String author;
  
      @Basic
      @Column(name = "publication_date")
      private Date publicationDate;
  
      @Basic
      @Column(name = "rank")
      private Integer rank;
  }
  </code></pre>
  
  <p>Because I can not have books with the same isbn in the table and I don't want to worry about generating ids I normally post the following json to an enpoint</p>
  
  <p><code>
  {
      "isbn": "10932011",
      "title": "harry",
      "author": "jk",
      "publicationDate": "2018-10-10",
      "rank": 1000
  }</code></p>
  
  <p>Which returns the following with an auto generated id</p>
  
  <p><code>{
      "id": 3,
      "isbn": "10932011",
      "title": "harry",
      "author": "jk",
      "publicationDate": "2018-10-10T00:00:00.000+0000",
      "rank": 1000
  }</code></p>
  
  <p>If I make second call using the same isbn I'll get a constraint error</p>
  
  <p><code>
  {
     "isbn": "10932011",
     "title": "harry",
     "author": "jk3",
     "publicationDate": "2018-10-10",
     "rank": 1000
   }</code></p>
  
  <p>But I would like to in fact update the book with the same isbn and not have to specify the auto generated id in the post json as this is not important to me. Is there a way of doing this without having to add logic to a service class?</p>