title: Bulk insert with Spring Boot and Spring Data JPA not working
body: <p>I know that there are many similar questions about this argument, but I really need a working solution.</p>
  
  <p>I'm trying to configure Spring Boot and Spring Data JPA in order to make bulk insert in a batch.</p>
  
  <p>The target is: <strong>commit each N-records</strong>, not every single record when making <code>repository.save()</code> action.</p>
  
  <p>What I've tried since now in the <code>application.properties</code>:</p>
  
  <pre><code>spring.jpa.properties.hibernate.jdbc.batch_size=100
  spring.jpa.properties.hibernate.order_inserts=true
  spring.jpa.properties.hibernate.order_updates=true
  spring.jpa.properties.hibernate.generate_statistics=true
  </code></pre>
  
  <p>But with no success. I've monitored the database and records are persisted in tables one-by-one, not 100-by-100 like I've configured.</p>
  
  <p>UPDATE</p>
  
  <p>Here's the implementation:</p>
  
  <pre><code>@Component
  public class BulkInsert {
  
      @Autowired
      MyRepository repository;
  
      public void process() {
  
          PodamFactory podamFactory = new PodamFactoryImpl();
  
          for(int i=0;i&lt;10000;i++) {
              MyEntity myEntity = podamFactory.manufacturePojo(MyEntity.class);
              repository.save(myEntity);
          }
  
      }
  }
  </code></pre>
  
  <p>Here's the entity:    </p>
  
  <pre><code>@Entity
  @Table(name="MYTABLE")
  @NamedQuery(name="MyEntity.findAll", query="SELECT m FROM MyEntity m")
  public class MyEntity implements Serializable {
      private static final long serialVersionUID = 1L;
  
      @Column(name="DESCRIPTION")
      private String description;
  
      @Id
      @Column(name="ID")
      private String id;
  
      public MyEntity() {
      }
  
      // getters and setters
  
  }
  </code></pre>
  
  <p>And the repository:</p>
  
  <pre><code>public interface MyRepository extends CrudRepository&lt;MyEntity, String&gt; {
  
  }
  </code></pre>