Browse Source

Reinstate support for Hibernate < 5.5

See gh-27352
pull/27405/head
Andy Wilkinson 4 years ago
parent
commit
51fedd6528
  1. 10
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateProperties.java
  2. 1
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-hibernate52/src/main/resources/application.properties

10
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateProperties.java

@ -173,18 +173,18 @@ public class HibernateProperties { @@ -173,18 +173,18 @@ public class HibernateProperties {
private void applyNamingStrategies(Map<String, Object> properties) {
applyNamingStrategy(properties, AvailableSettings.IMPLICIT_NAMING_STRATEGY, this.implicitStrategy,
SpringImplicitNamingStrategy.class.getName());
() -> SpringImplicitNamingStrategy.class.getName());
applyNamingStrategy(properties, AvailableSettings.PHYSICAL_NAMING_STRATEGY, this.physicalStrategy,
CamelCaseToUnderscoresNamingStrategy.class.getName());
() -> CamelCaseToUnderscoresNamingStrategy.class.getName());
}
private void applyNamingStrategy(Map<String, Object> properties, String key, Object strategy,
Object defaultStrategy) {
Supplier<String> defaultStrategy) {
if (strategy != null) {
properties.put(key, strategy);
}
else if (defaultStrategy != null && !properties.containsKey(key)) {
properties.put(key, defaultStrategy);
else {
properties.computeIfAbsent(key, (k) -> defaultStrategy.get());
}
}

1
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-hibernate52/src/main/resources/application.properties

@ -0,0 +1 @@ @@ -0,0 +1 @@
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
Loading…
Cancel
Save