Add support for advanced customization of Hibernate settings

As HibernateJpaConfiguration is package private, it is no longer
possible to extend the default Spring Boot configuration to apply
advanced settings. The most notable use case for this is the
customization of Hibernate properties using instance value vs. string
value that can be set using the "spring.jpa.properties" namespace.

This commit adds a HibernatePropertiesCustomizer callback interface that
can be implemented to tune Hibernate properties at will.

Closes gh-11211
This commit is contained in:
Stephane Nicoll
2018-01-05 12:19:22 +01:00
parent 268b97bf98
commit 59d5ed5842
7 changed files with 147 additions and 11 deletions

View File

@@ -1787,6 +1787,11 @@ In addition, all properties in `+spring.jpa.properties.*+` are passed through as
JPA properties (with the prefix stripped) when the local `EntityManagerFactory` is
created.
TIP: if you need to apply advanced customization to Hibernate properties, consider
registering a `HibernatePropertiesCustomizer` bean that will be invoked prior to creating
the `EntityManagerFactory`. This takes precedence to anything that is applied by the
auto-configuration.
[[howto-configure-hibernate-naming-strategy]]