AnnotationExceptionNo identifier specified for entity错误org.hibernate.AnnotationException: No identifier specified for entityorg.hibernate.AnnotationException: No identifier specified for entity.
报这个异常的原因是因为pojo类的主键没有注解映射关系(或者没有主键)
解决方案如下:(以下注解写在get方法上,而非set方法)
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="ID", unique=true, nullable=false, insertable=true, updatable=false, precision=20, scale=0)
或者
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "sequence",
parameters = { @Parameter(name = "sequence", value = "TEST_SEQ") })
错误org.hibernate.AnnotationException: No identifier specified for entity
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
hibernate_0100_HelloWorld
曉竹
2019-02-23 13:35:33
Hibernate 1+N 问题
liudajiang
2019-02-23 12:53:51
基于注解的struts2+spring+hibernate集成
529719752
2019-02-23 00:39:39
(J2EE学习笔记)hibernate的实体映射(双向一对一)
w1sw
2019-02-23 00:33:03
(J2EE学习笔记)解决Hibernate删除异常:deleted object would be re-saved by cascade
w1sw
2019-02-23 00:33:03
JAVA框架之第一个Hibernate实际应用
baple
2019-02-23 00:17:04
选用ibatis和hibernate的区别
lily_better
2019-02-23 00:11:33
Hibernate配置文件中hiberante.hbm2ddl.auto四个参数的配置
lionheartli
2019-02-23 00:05:51
Hibernate程序性能优化的考虑要点
FarXiang
2019-02-23 00:05:45
spring整合hibernate的applicationContext.xml文件配置以及web.xml
封起De日子
2019-02-23 00:02:24
写出MVC的三个字母分别代表什么含义
congwa2015
2019-02-22 23:54:25
hibernate报错:org.hibernate.MappingException: Could not determine type for: Integer, for columns
gongzi_xiaowang
2019-02-22 23:44:11
hibernate中inverse的用法
Jayson_Lee
2019-02-22 23:28:15
数据库基础--主键
wx57cb9069e923f
2019-02-23 00:41:28
24小時熱門文章