title: How to bulk insert with Spring-Batch?
body: <p>I'm trying to do bulk/batch inserts using <code>spring-batch</code>.</p>
  
  <pre><code>public ItemWriter&lt;MyEntity&gt; jpaItemWriter() {
      LocalSessionFactoryBuilder builder = new LocalSessionFactoryBuilder(ds);
      builder.addAnnotatedClasses(MyEntity.class);
      builder.setProperty("hibernate.show_sql", "true");
      builder.setProperty("hibernate.batch_size", "20");
      builder.setProperty("hibernate.order_updates", "true");
      builder.setProperty("hibernate.order_inserts", "true");
      HibernateItemWriter&lt;MyEntity&gt; writer = new HibernateItemWriter&lt;&gt;();
      writer.setSessionFactory(builder.buildSessionFactory());
      return writer;
  }
  </code></pre>
  
  <p>Result:
  I'm getting only single <code>insert</code> statements, not bulk inserts! I can see it from the logs both of hibernate + on postgresql level. Why is the bulk insert not working?</p>
  
  <p>Update:</p>
  
  <pre><code>@Entity
  public class MyEntity {
      @Id
      String shortname;
      String fullname;
  }
  </code></pre>