Spring batch size hibernate jdbc

I have several scenarios that I think are a bit obscure from hibernate documenation .

Data class:

class HibernateDao {
      // ...

      @Transactional
      public void store(List<Object> batch) {
          for(Object o : batch) {
             hibernate.store(o);
          }
      }
}

Scenario 1

hibernate.jdbc.batch_size = 1

Q1 . What happens when called store(..)with a collection of items 10? Will there be 10 x 1 transactions or only one?


Scenario 2

hibernate.jdbc.batch_size = 10

Q2 : what happens when called store(..)with a collection of elements 1? Will it be immediately written to the storage, regardless of the batch_size property?


From the sleep mode documentation:

Hibernate disables JDBC-level package embedding transparently if you use an identifier generator

Q3 : what is classified as identify identifier generatorusing annotations @Idand @GeneratedValue(strategy = GenerationType.AUTO)?

+3
1

Q1: store (..) 10 ? 10 x 1 ?

Spring, , Hibernate, "", "" "" . , .

Q2: store (..) 1 ? , batch_size?

. : "", Hibernate .

Q3: , @Id @GeneratedValue (strategy = GenerationType.AUTO)?

, Hibernate . , (, , T-SQL), , ,... : Hibernate , , . Hibernate , JDBC "getGeneratedKeys", , .

Hibernate , ( : , hilo, uuid,...), .

+7

All Articles