我对SpringBoot(1.3.0)对Hibernate5的支持感到有些困惑.该引用列出了对hibernate 4.3.11.Final的依赖,但它也列出了对SpringFramework 4.2.3的依赖,其中包括Hibernate5支持.
是否只需添加额外的Hibernate5依赖项来覆盖Boot bundle的内容?有人可以为我澄清一下吗?
我正在使用Spring Boot 1.3.3.RELEASE。默认情况下,Spring Boot使用Hibernate Version4.x。我正在尝试使用新的Hibernate,即5.1.0 FINAL(截至目前)。
我正在使用Gradle,以便覆盖Hibernate版本,所以我添加了以下行
ext['hibernate.version']="5.1.0.Final"
Run Code Online (Sandbox Code Playgroud)
我正在使用以下方法命名策略
spring.jpa.properties.hibernate.naming.implicit-strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyHbmImpl
spring.jpa.properties.hibernate.naming.physical_strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
Run Code Online (Sandbox Code Playgroud)
我有一个实体课
@Entity
public class AppUser {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Length(max = 100)
private String username;
@NotNull
@Length(max = 100)
private String firstName;
@NotNull
@Length(max = 100)
private String lastName;
@Length(max = 100)
private String middleName;
@NotNull
@Length(max=100)
private String email;
@NotNull
@Length(max = 100)
private String password;
@NotNull
private boolean enabled;
}
Run Code Online (Sandbox Code Playgroud)
在Hibernate 4.x上,它执行查询
create table app_user …Run Code Online (Sandbox Code Playgroud)