Skip to content

@ExpectJdbcBatching

Jean Bisutti edited this page Feb 6, 2020 · 8 revisions

Verify that inserts, deletes and updates are processed in JDBC batches having batchSize elements. You may sometimes think that you are using JDBC batching but in fact not (Paper 1, Paper 2)! Batching of inserts, updates and deletes allows to reduce the number of roundtrips to the database which can dramatically impact application performance. You can decide to batch all inserts, updates, delete. Prior to Hibernate 5.2, batching, when enabled with a hibernate.jdbc.batch_size property stricly positive, was applied to all inserts, updates and deletes (from Hibernate 5.2 it is also possible to override the batch size value for a given session).

πŸ”§ Parameters

Parameter Type Meaning Default value
batchSize int JDBC batch size -

batchSize is optional.

A 0 batch size means that JDBC batching is disabled.

πŸ”Ž Example

    @ExpectJdbcBatching(batchSize = 30)

Annotations

πŸ‘‰ Β Core

πŸ‘‰ Β JVM

πŸ‘‰ Β SQL

πŸ‘‰ Β Scopes

πŸ‘‰ Β Create an annotation

Supported frameworks

πŸ‘‰ Β JUnit 4

πŸ‘‰ Β JUnit 5

πŸ‘‰ Β TestNG

πŸ‘‰ Β Spring

How to

πŸ‘‰ Β Detect and fix N+1 SELECT

Project examples

πŸ‘‰ Β Maven performance

πŸ‘‰ Β Spring Boot - JUnit 4

πŸ‘‰ Β Spring Boot - JUnit 5

πŸ‘‰ Β Micronaut Data - JUnit 5

πŸ‘‰ Β Micronaut - Spring - JUnit 5

πŸ‘‰ Β Quarkus - JUnit 5

Miscellaneous

πŸ‘‰ Β FAQ

πŸ‘‰ Β QuickPerf code

Clone this wiki locally