今天在测试 jpa 读取数据库时出现这错误,指示没有实体标识符
Caused by: org.hibernate.AnnotationException: No identifier specified for entity
根据Hinbernate的规范,一定要为实体类添加唯一的标识符,即主键id。在私有变量或set方法之上添加注解即可。
@Id
@GeneratedValue
private Integer categoryId;
---------------------
作者:Yekongle
来源:CSDN
原文:https://blog.csdn.net/qq_23483671/article/details/79056174
版权声明:本文为博主原创文章,转载请附上博文链接!