Unknown integral data type for ids : java.lang.String] with root cause

学习spring boot 操作数据库时,post请求新增一条记录时报错

Unknown integral data type for ids : java.lang.String

报主键id 类型错误。 主键设置的是自增的。

将主键换成UUID即可

@Entity
public class Gril {

    @Id @GeneratedValue(generator="system-uuid")
    @GenericGenerator(name="system-uuid", strategy = "uuid")
    private String id;

    private String cupSize;

    private Integer age;

    public String getId() {
        return id;
    }

    public Gril() {
    }

    public void setId(String id) {

        this.id = id;
    }

    public String getCupSize() {
        return cupSize;
    }

    public void setCupSize(String cupSize) {
        this.cupSize = cupSize;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}

你可能感兴趣的:(数据库,Spring,boot)