Caused by: org.hibernate.AnnotationException: No identifier specified for entity
程序员文章站
2022-04-12 16:26:50
...
今天在测试 jpa 读取数据库时出现这错误,指示没有实体标识符
Caused by: org.hibernate.AnnotationException: No identifier specified for entity
根据Hinbernate的规范,一定要为实体类添加唯一的标识符,即主键id。在私有变量或set方法之上添加注解即可。
@Id
@GeneratedValue
private Integer categoryId;
上一篇: js原生左滑删除
下一篇: Java与php 实现重载对比案例
推荐阅读
-
错误org.hibernate.AnnotationException: No identifier specified for entity
-
JPA 异常: Caused by: org.hibernate.AnnotationException: No identifier specified for entity
-
Caused by: org.hibernate.AnnotationException: No identifier specified for entity
-
Caused by: org.hibernate.AnnotationException: No identifier specified for en . . . . .
-
Caused by: org.hibernate.AnnotationException: No identifier specified for entity
-
Caused by: org.hibernate.AnnotationException: No identifier specified for entity:
-
Caused by: org.hibernate.AnnotationException: No identifier specified for en . . . . .