hibernate-orm is missing some important Hibernate batch configuration options
See original GitHub issueDescription
See https://quarkus.io/guides/hibernate-orm for current list and https://vladmihalcea.com/how-to-batch-insert-and-update-statements-with-hibernate/ for additional needed options, e.g.
hibernate.order_inserts
hibernate.order_updates
hibernate.jdbc.batch_versioned_data
Is it planned to add them?
Workaround
Using persistence.xml
Implementation ideas
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (8 by maintainers)
Top Results From Across the Web
Hibernate ORM 5.6.14.Final User Guide - Red Hat on GitHub
There is yet another important runtime impact of choosing IDENTITY generation: Hibernate will not be able to batch INSERT statements for the entities...
Read more >Using Hibernate ORM and JPA - Quarkus
When using Hibernate ORM in Quarkus, you don't need to have a persistence.xml resource to configure it. Using such a classic configuration file...
Read more >GORM for Hibernate - Grails
And the following are common configuration options for Hibernate: ... Hibernate batches up SQL statements and executes them as late as possible, ...
Read more >Logging Guide for Hibernate 4, 5 & 6 - Use the right config for ...
Some logging features, like the slow query log, aren't available in older Hibernate versions, and Hibernate 6 changed the names of a few...
Read more >Home of Quarkus Cheat-Sheet - GitHub Pages
You can define the main CLI method to start Quarkus. ... You can define for each Test class a different configuration options. ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As to
hibernate.order_inserts
: I have optimized bulk inserts by a factor of about 50 by using Hibernate batching in the case of entities without relations. This optimization is very important for the application.However, for an entity type using
@OneToMany
, batching is not applied due to the entity types’ not being sorted, so that singleINSERT
s are being generated.It would be good to be able to stick with
application.yaml
properties instead of having to revert to apersistence.xml
.My suggestion for a “salomonic” solution: Instead of adding this property, which seems to have problems in some cases, to the
quarkus.hibernate-orm.*
- path, introducequarkus.jpa.properties.*
(analogous to SpringData), where one can set native JPA provider properties, which in the case of Hibernate will translate:quarkus.jpa.properties.foo.baz -> hibernate.foo.baz
Thus,
hibernate-orm
can stick to a limited set of “opinionated” properties based on the module developers’ reasoning, but the application developer has the liberty to apply arbitrary properties at their own risk. If it is made clear in the documentation, that using this puts the application developers at their own risk, it should not be too much of a hassle.Right, and same for the others.
FWIW:
ORDER_INSERTS
is meant to be enabled in a similar way in the future, it’s not today as there are some open issues related to it.Regarding
BATCH_VERSIONED_DATA
, we’re not setting it today but I guess we could take this in consideration; I’d need to better understand what implications this would have on designing applications making use of optimistic lockinng.In general, I prefer to not expose many of these but rather make sure we automatically set the best strategies; this might also lead to removing of some such properties from ORM down the road, and allow us to better test all permutations of these options.