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

来源:互联网 发布:windows 网络监控工具 编辑:程序博客网 时间:2024/06/02 13:50
Caused by: org.hibernate.AnnotationException: No identifier specified for entity: com.ffcs.esm.entitys.ProductNameat 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;}




原创粉丝点击