小编Dan*_*iel的帖子

无法使用 jpa+spring boot 创建表

我正在尝试使用 JPA 生成表。但我无法创建它。代码没有错误,但是好像有配置错误。但我找不到它,我尝试了很多配置但没有任何反应。非常感谢。

这是application.property

spring.datasource.url=jdbc:mysql://localhost:3306/springapp
spring.datasource.username= root
spring.datasource.password= me
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto=create
Run Code Online (Sandbox Code Playgroud)

这是我的课:

@Entity
public class Customer {

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private int id;
    private String name;
    private String phone;

    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public Customer(String …
Run Code Online (Sandbox Code Playgroud)

java hibernate spring-data-jpa spring-boot

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

hibernate ×1

java ×1

spring-boot ×1

spring-data-jpa ×1