Introduction In this article, we are going to see how we can override the default FlushMode used by Hibernate. If you bootstrap Hibernate natively, and not as a JPA provider, de default FlushMode.AUTO is used which, as explained in this article, does not trigger a Persistence Context flush prior to executing a native SQL query.
Introduction JDBC batching has a significant impact on reducing transaction response time. As previously explained, you can enable batching for INSERT, UPDATE and DELETE statements with just one configuration property: However, this setting affects every Persistence Context, therefore every business use case inherits the same JDBC batch size. Although the hibernate.jdbc.batch_size configuration property is extremely useful, it would be great if we could customize the JDBC batch size on a per Persistence Context basis. This article demonstrates how easily you can accomplish this task.