JPA Entity Annotation

The @Entity annotation is used to specify that the class is an entity.


Name: The Name attribute is used to specify the entity name. It is an optional attribute. Defaults to the unqualified name of the entity class. It is contained in the javax.persistence package.

Note: If you are using Hibernate as the JPA implementation the javax.persistence.Entity is still mandatory. The org.hibernate.annotations.Entity is a compliment for @javax.persistence.Entity and not a replacement.

JPA Entity Annotation Example

public class class_name {
//class body