No identifier specified for entity: com.example.mobile_cd.po.User报错/springboot自动生成表报错

今天在IDEA里用代码直接生成表的时候报错:
No identifier specified for entity: com.example.mobile_cd.po.User
另附上一个简单的JPA配置及实例:
https://blog.****.net/qq_45128278/article/details/104986925

部分文件目录:

No identifier specified for entity: com.example.mobile_cd.po.User报错/springboot自动生成表报错

错误原因:

po包内的User.java中的包导入出错。因为导入的时候有两个选项:
一个是spring framake里的,一个是javax.persistence里的;应该导入后者。
下图是正确的。
No identifier specified for entity: com.example.mobile_cd.po.User报错/springboot自动生成表报错