Caused by: org.hibernate.AnnotationException: No identifier specified for entity
程序员文章站
2022-04-12 16:26:08
...
今天在测试 jpa 读取数据库时出现这错误,指示没有实体标识符
Caused by: org.hibernate.AnnotationException: No identifier specified for entity
根据Hinbernate的规范,一定要为实体类添加唯一的标识符,即主键id。在私有变量或set方法之上添加注解即可。
@Id
@GeneratedValue
private Integer categoryId;
上一篇: 深入理解JS正则表达式之范围类的解析
推荐阅读
-
错误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 . . . . .