SpringBoot2 JPA No Identifier specified for entity的解决办法

No Identifier specified for entity的错误

此类注解都在
import javax.persistence.*;
包下

    @Id
    @GeneratedValue(strategy= GenerationType.AUTO)
原因:以上文字没写或者写错了地方,导致找不到主键。
解决办法:在数据库表对应实体(entity.java)的方法:getId()前加上该段文字。

P.S.: strategy= GenerationType.AUTO中的AUTO应当换成你所使用的主键生成方式
原文地址:https://www.cnblogs.com/hfultrastrong/p/8600385.html