No Identifier specified for entity的错误

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

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

P.S.: strategy= GenerationType.AUTO中的AUTO应当换成你所使用的主键生成方式

相关文章:

  • 2022-01-17
  • 2021-05-11
  • 2022-12-23
  • 2021-11-24
  • 2021-12-26
  • 2022-12-23
猜你喜欢
  • 2022-01-17
  • 2021-04-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2022-02-08
相关资源
相似解决方案