title: Spring DAO rewritebatchedstatements not working on SaveAll() on entities with embeddedId
body: <p>We need to insert 5 million records fast on <strong>mysql</strong> (no control on this instance).</p>
  
  <p>Tried all below and nothing works:</p>
  
  <ol>
  <li>set <code>rewritebatchedstatements=true</code> (both through url and props)</li>
  <li>tried <code>useServerPrepStmts=true</code> and <code>useServerPrepStmts=true</code></li>
  <li>tried other hibernate props as below</li>
  <li><code>Story</code> has <code>GenerationType.Auto</code> so its ok, but <code>Task</code> is <code>EmbeddedId</code> so batch should work? (because no generation specified)</li>
  <li>Tried <code>MySql5InnoDBDialect</code> and <code>MySql5DBDialect</code></li>
  </ol>
  
  <p>Batching is working (based on statistics) but <code>rewritebatchedstatements</code> is not working.</p>
  
  <pre><code>spring.jpa.properties.hibernate.jdbc.batch_size=500
  spring.jpa.properties.hibernate.jdbc.fetch_size=500
  spring.jpa.properties.hibernate.jdbc.order_inserts=500
  spring.jpa.properties.hibernate.jdbc.order_updates=500
  
  spring.jpa.properties.hibernate.batch_versioned_data=true
  spring.jpa.properties.hibernate.generate_statistics=true
  
  spring.datasource.hikari.data-source-properties.rewriteBatchedStatements=true
  #spring.datasource.hikari.data-source-properties.useServerPrepStmts=true
  spring.datasource.hikari.data-source-properties.useServerPrepStmts=false
  </code></pre>
  
  <p>Sample Entities:</p>
  
  <pre><code>class SprintService {
  
     @Transactional
      public void startSprint(Epic epic, List&lt;Stories&gt; stories) {
          epic.save()
          .....
          stories.saveAll() // few hundreds of records
          Set&lt;Task&gt; tasks = new HashSet&lt;&gt;;
          for(Story story: stories)
          {
              tasks.addAll(story.getTasks());
              tasks.addAll(story.getTasks());
              tasks.addAll(story.getTasks());
              //do something
          }
          tasks.saveAll() // few million records
      }
  }
  
  @Table(name = "STORY")
  @EqualsAndHashCode
  class Story {
     @Id
     @GeneratedValue(stratergy=GenerationType.Auto)
     @Column(name="STORY_ID")
     Long id;
  
     @Column(name="STORY_NAME")
     String name;
  
     @OneToMany(cascade=MERGE, mappedBy="story", fetch = FetchType.Lazy)
     Set&lt;Task&gt; task;
  }
  
  
  
  @Entity
  @Table(name = "TASK_XREF")
  class Task {
      @EmbeddedId
      TaskPKId taskPKId;
  
      @Column(name = "TASK_NAME")
      String name;
      @MapsId("storyId")
      @ManyToOne(fetch = FetchType.LAZY, optional = false)
      @JoinColumn(name = "STORY_ID")
      Story story;
  
      //getters, setters
  
  }
  </code></pre>
  
  <p>And here is the TaskPKID class:</p>
  
  <pre><code>@Embeddable
  class TaskPKId  implements Serializable {
          long taskId;
          long taskTypeId;
          @Column(name="STORY_ID")
          long storyId;
  
      public long getTaskId() {
          return taskId;
      }
  
      public void setTaskId(long taskId) {
          this.taskId = taskId;
      }
  
      public void setTaskTypeId(long taskTypeId) {
          this.taskTypeId = taskTypeId;
      }
  }
  </code></pre>