we are using Hibernate via SpringDataJPA and have a non-functional requirement that our application must not connect to database during startup time.
Because Hibernate by default always seems to use a database connection during application startup to retrieve some database meta data we configured parameter
like discussed in https://MultiTenant Hibernate + Spring boot - How to prevent it from looking up ….
This worked fine until upgrading from Spring Boot 2.5 (hibernate-core version 5.4.33) to Spring Boot 2.6 (hibernate-core version 5.6.7):
Since then INSERT and UPDATE statements are executed as single statements instead of JDBC batch statements which has a major performance impact.
We debugged this effect and it seems to be caused by commit 6c53a9d1abf1bb2e38cfbb986a8bb33188aacfb9 - after this commit the configured
spring.jpa.properties.hibernate.jdbc.batch_size seems to be “overruled” by
ExtractedDatabaseMetaDataImpl#supportsBatchUpdates() which returns
DatabaseMetaData was not read from a database connection.
Is there a way in current hibernate-core version 5.6.7 to fulfill the two requirements “no database connection at application startup” AND “INSERT / UPDATE with JDBC Batch statements”?
If not: where could a requirement to Hibernate be placed?
Thanks a lot for any suggestions