Commit 6858c398 authored by Phillip Webb's avatar Phillip Webb Committed by Phillip Webb

Use Hibernate ImprovedNamingStrategy by default

Update HibernateJpaAutoConfiguration to use the ImprovedNamingStrategy
for better table and column names.

Issue: #55261888
parent 7e3cb50a
...@@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.orm.jpa; ...@@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.orm.jpa;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import org.hibernate.cfg.ImprovedNamingStrategy;
import org.hibernate.ejb.HibernateEntityManager; import org.hibernate.ejb.HibernateEntityManager;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
...@@ -80,6 +81,8 @@ public class HibernateJpaAutoConfiguration extends JpaBaseConfiguration { ...@@ -80,6 +81,8 @@ public class HibernateJpaAutoConfiguration extends JpaBaseConfiguration {
Map<String, Object> properties = entityManagerFactoryBean.getJpaPropertyMap(); Map<String, Object> properties = entityManagerFactoryBean.getJpaPropertyMap();
properties.put("hibernate.cache.provider_class", properties.put("hibernate.cache.provider_class",
"org.hibernate.cache.HashtableCacheProvider"); "org.hibernate.cache.HashtableCacheProvider");
properties.put("hibernate.ejb.naming_strategy",
ImprovedNamingStrategy.class.getName());
if (StringUtils.hasLength(this.ddlAuto) && !"none".equals(this.ddlAuto)) { if (StringUtils.hasLength(this.ddlAuto) && !"none".equals(this.ddlAuto)) {
properties.put("hibernate.hbm2ddl.auto", this.ddlAuto); properties.put("hibernate.hbm2ddl.auto", this.ddlAuto);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment