hibernate错误org.hibernate.AnnotationException: No identifier specified for entity:

Caused by: org.hibernate.AnnotationException: No identifier specified for entity: com.ffcs.esm.entitys.ProductName
at org.hibernate.cfg.InheritanceState.determineDefaultAccessType(InheritanceState.java:277)
at org.hibernate.cfg.InheritanceState.getElementsToProcess(InheritanceState.java:224)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:666)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3435)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3389)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1341)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1731)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)
... 55 more

hibernate的annotation报错,错误原因是因为在对ProductName进行对象关系映射的时候忘记加上主键@Id了。

	@Id
	@Column(name = "SPID", length = 8)
	public String getSpid() {
		return spid;
	}




阅读更多
文章标签: hibernate jpa
个人分类: Hibernate
上一篇oracle 按每天,每周,每月,每季度,每年查询统计数据
下一篇MyEclipse优化配置
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭