title: Spring Boot repository save does not work (only shows a select)
body: <p>I'm facing for hours with a strange proceeding in Spring Boot when try to save a mapped entity.</p>
  
  <p>The entity class with a composite key that must all be set by the user is as follows:</p>
  
  <pre><code>package model
  
  import javax.persistence.*
  
  @Entity
  @Table(name = 'MY_TABLE')
  @IdClass(MyIdClass.class)
  class MyClass implements Serializable{
  
      @Id
      @Column(name = "MY_COLUMN_1")
      Long column1
  
      @Id
      @Column(name = "MY_COLUMN_2")
      Long column2
  
      @Id
      @Column(name = "MY_COLUMN_3")
      String column3
  
      @Id
      @Column(name = "MY_COLUMN_4")
      Date date1
  
      @Column(name = "MY_COLUMN_5")
      Date date2
  
      @Column(name = "MY_COLUMN_6")
      BigDecimal column6
  }
  
  @Embeddable
  class MyIdClass implements Serializable{
      Long column1
      Long column2
      String column3
      Date date1;
  }
  </code></pre>
  
  <p>The corresponding repository is:</p>
  
  <pre><code>package repository
  
  import org.springframework.data.repository.CrudRepository
  
  interface MyRepository extends CrudRepository&lt;MyClass, Long&gt;{
  }
  </code></pre>
  
  <p>My service is:</p>
  
  <pre><code>package service
  
  import model.MyClass
  import repository.MyRepository
  import org.springframework.beans.factory.annotation.Autowired
  import org.springframework.stereotype.Service
  
  @Service
  class MyService {
  
      @Autowired
      MyRepository repository
  
      void save(MyClass myClass) {
          repository.save(myClass)
      }
  }
  </code></pre>
  
  <p>My controller mounts a MyClass object with all data set, including the composite key. When it calls the service save method the object is not inserted in the database. I saw the logs and checked that there is a SELECT in MY_TABLE instead of INSERT. I tried not to inform the composite key in the object and then the save method did an INSERT with error due to null values in the primary key.</p>
  
  <p>I really don't understand why the insertion is not done when the composite key has values. How can I solve it?</p>
  
  <p>I've already tried with @Transactional in service class and didn't work. I didn't do any Transaction configuration in the project since Spring Boot delivers it as default.  </p>
  
  <p>Thanks.</p>