Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error - org.hibernate.AnnotationException: No identifier specified for entity

 
subir rastogi
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have example in JPA and getting following error during deploying the ear to JBOSS.
org.hibernate.AnnotationException: No identifier specified for entity: com.entity.Cabin
Here is the Cabin class -


Please advice on what could be the issue here?

thanks.
 
Remko Strating
Ranch Hand
Posts: 893
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to use the annotations on the get methods of your entity.
 
subir rastogi
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Remko, using annotations on the get methods solved the problem..

I am learing JPA so its a requirement that annotations should be used on getters only?

Thanks.
 
Remko Strating
Ranch Hand
Posts: 893
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it is, but you have already discovered that.

Also mostly I do the getter above the setter.
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
subir rastogi wrote:
I am learing JPA so its a requirement that annotations should be used on getters only?



Getters or fields. Note that you can't mix and match them though - i.e. you can't have an entity with some fields annotated and some getters annotated for JPA.
 
subir rastogi
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Jaikiran and Remko for the clarification.
 
babu joy
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error also comes if the class doesn't have an @Id attribute
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic