"AnnotationException: No identifier specified for entity" in Hibernate
Issue
When deploying a persistent unit, encountering the following exception
org.hibernate.AnnotationException: No identifier specified for entity: test.MyEntity
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:665)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3537)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3491)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1376)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1781)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
... 9 more
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 5
- 6
- Hibernate
- 3
- 4
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
