Thursday, 22 August 2013

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


Problem :

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

Solution:

You are missing a field annotated with @Id.

Each @Enitity needs an @Id - this is the primary key in the database.

If you don't want your entity to be persisted in a separate table, but rather be a part of other entities, you can use @Embeddable instead of @Entity.

No comments:

Post a Comment

Spring boot with CORS

CORS (Cross-Origin Resource Sharing) errors occur when a web application running in a browser requests a resource from a different domain or...