No identifier specified for entity: XXXX 错误
在运行项目的时候报了下面的错误:
by: org.hibernate.AnnotationException: No identifier specified for entity: com.example1.demo1.Entity.User
at org.hibernate.cfg.InheritanceState.determineDefaultAccessType(InheritanceState.java:266) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
at org.hibernate.cfg.InheritanceState.getElementsToProcess(InheritanceState.java:211) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:731) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:249) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:222) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:861) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:888) ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
这是因为在实体的getID方法上没有加上此@Id注解,但是检查了一次确实加上了,最后的解决办法如下:
是因为id注解引错的包
错误的包路径:
import org.springframework.data.annotation.Id;
正确的包路径:
import javax.persistence.Id;
最后得以解决,小伙伴们千万别粗心大意啊
No identifier specified for entity: XXXX 错误的更多相关文章
- SpringBoot2 JPA No Identifier specified for entity的解决办法
No Identifier specified for entity的错误 此类注解都在 import javax.persistence.*;包下 @Id @GeneratedVal ...
- org.hibernate.AnnotationException: No identifier specified for entity: com.example1.demo1.Entity.User错误
最近在公司带人,他们问我的问题在这里也顺便总结下. 此项目为SpringDataJpa项目. 出现的错误如下: Caused by: org.hibernate.AnnotationException ...
- springboot No Identifier specified for entity的解决办法
今天在做一个项目的时候遇到一个问题,实体类忘了指定主键id,然后报如下错误,也是自己粗心大意造成的,在此记录下. java.lang.IllegalStateException: Failed to ...
- No identifier specified for entity: springboot-jpa报错No identifier specified for entity
说明:此次学习使用了springboot框架,jpa注解映射实体类 1,No identifier specified for entity: com.tf.model.User 看到此错误第一反应百 ...
- JPA error org.hibernate.AnnotationException: No identifier specified for entity
错误:org.hibernate.AnnotationException: No identifier specified for entity 原因:JPA所使用的Entity需要标注@Id,在引用 ...
- Springboot- Caused by: org.hibernate.AnnotationException: No identifier specified for entity:
错误与异常: Caused by: org.hibernate.AnnotationException: No identifier specified for entity: 原因:引用了不对的包, ...
- An entity cannot be annotated with both @Entity and @MappedSuperclass: com.example1.demo1.Entity.User错误
项目问SpringDataJpa项目,在运行的过程中出现的以下错误: Caused by: org.hibernate.AnnotationException: An entity cannot be ...
- Mingyang.net:No identifier specified for entity
org.hibernate.AnnotationException: No identifier specified for entity: net.mingyang.modules.system.C ...
- No identifier specified for entity
主键问题 使用hibernate的e-r映射pojo类的时候遇到org.hibernate.AnnotationException: No identifier specified for ent ...
随机推荐
- webpack.config.js====webpack-dev-server开发服务器配置
1. 安装webpack-dev-server(在指定目录下),一定要先安装完毕webpack webpack-cli之后在安装webpack-dev-server 一个基于expressjs的开发服 ...
- Get和Post的初步探究
Get请求和Post请求这两种基本请求类型,大部分开发者心里大概都有所谓的"标准答案",但博主最近用Postman测试接口的时候,遇到传参的问题:用post请求,参数放在reque ...
- htmlparse
<html> <head> <style> textarea{ width:800p ...
- js正则匹配获取文件名
//获取文件名,不带后缀 var file_name=file_path.replace(/(.*\/)*([^.]+).*/ig,"$2"); //获取文件后缀 1.var Fi ...
- 帝国empirecms后台登陆次数限制修改
打开文件:\e\config\config.php, 找到 'loginnum'=>5, 把5改为自己想要的数字即可
- 常用css和js组件
1 . input框中插入图标 <div class="col-sm-12 col-xs-12 setLineHeight"> <div class=" ...
- 修改wamp的数据库密码
方法/步骤 一:修改数据库密码 1.点开MySQL console进入数据库编辑框,然后按回车键,会出现图2的效果. 2.接着输入“use mysql” 下面提示“Database chang ...
- 首次将项目从eclipse提交到服务器的SVN
1.在Eclipse项目中,点击需要提交到svn的项目,鼠标右键,如下图: 2.鼠标右键后,我们看到Team选项,在二级菜单中点击“Share Project”,这个时候弹出“Share Projec ...
- hihoCoder #1050 : 树中的最长路
题意: 求出树上最长路径的长度,并返回. 思路: 刚看到数据<=10^5,假如是单分支的树,那么有5万层,就不能递归,那就用桟实现, 那就要将长度信息保存在另开的数组中,很麻烦!!这题专门给递归 ...
- 重温Javascript(二)-对象
对象 可以想象成散列表,键值对,值可以是数据或函数 创建对象的方式 1.工厂模式 function createPerson(name, age, job){ var o = new Object() ...