1.弹簧引导
spring-boot-gradle-plugin:1.4.2.RELEASE2.分级
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-web')
testCompile('org.springframework.boot:spring-boot-starter-test')
compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '1.1.8'
}3.application.properties
spring.jpa.hibernate.ddl-auto=update4.实体
@Entity public class Users { @Id
private int id;
@Column(nullable = false,unique = true)
private int userId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
}Hibernate无法自动创建数据库索引或外键或约束或添加列
但是,什么时候
spring-boot-gradle-plugin:1.2.4.RELEASE一切都是正常的
如何解决
发布于 2017-01-05 01:53:59
发现问题时,mariadb版本太低了
compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '1.1.8'更改为
compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '1.5.6'一切都很好!
https://stackoverflow.com/questions/41236029
复制相似问题