项目中出现org.hibernate.AnnotationException: No identifier specified for entity 错误

项目中出现org.hibernate.AnnotationException: No identifier specified for entity 错误

解决办法:第一种:.看是否加@ID注解
第二种:正确的应该是import javax.persistence.Id 而我却导入了org.springframework.data.annotation.Id 这样虽然@Id 在IDE语法检查时不会报错,但并不是我们本来想要的那个功能,因此运行时会报上面但错误。

猜你喜欢

转载自blog.csdn.net/weixin_42190864/article/details/84143474