您可以在Spring Boot 1.3中使用Hibernate 4.3或Hibernate 5.0。如您所见,Hibernate 4.3.x是默认版本。
要使用Hibernate 5.0,您应该
hibernate.version在Spring Boot的依赖管理中覆盖该属性。假设您正在使用Maven:
<properties> <hibernate.version>5.0.5.Final</hibernate.version></properties>
使用Hibernate 5.0时,与使用Hibernate 4.3.x的最大不同是您将失去Spring Boot的自定义命名策略。由于Hibernate
5.0中所做的重大更改,您将在启动时看到类似以下的警告记录:
2015-12-07 10:04:56.911 WARN 81371 --- [main] org.hibernate.orm.deprecation : HHH90000006: Attempted to specify unsupported NamingStrategy via setting [hibernate.ejb.naming_strategy]; NamingStrategy has been removed in favor of the split ImplicitNamingStrategy and PhysicalNamingStrategy; use [hibernate.implicit_naming_strategy] or [hibernate.physical_naming_strategy], respectively, instead.
如果您不喜欢Hibernate
5的默认设置,则可以分别
application.properties使用
spring.jpa.properties.hibernate.implicit_naming_strategy和
spring.jpa.properties.hibernate.physical_naming_strategy属性在Spring
Boot中指定自定义的隐式或物理命名策略。



