org.hibernate.annotations.Entity deprecated in Hibernate 4?
From Hibernate Getting Started Guide :
The
@javax.persistence.Entity
annotation is used to mark a class as an entity. It functions the same as the class mapping element discussed in Section 2.3, "The mapping file". Additionally the@javax.persistence.Table
annotation explicitly specifies the table name. Without this specification, the default table name would be EVENT).
Since org.hibernate.annotations.Entity has been deprecated you should use the Java EE annotation. Also, as tolitius already mentioned, for the annotation configurations of @org.hibernate.annotations.Entity
, you should use the respective annotation, e.g. @DynamicUpdate
.
Hope that helps.
Note: Event
is the name of the class that is annotated in the example, this is why it states "default table name would be EVENT".
Yes it is deprecated in 4.0+:
Deprecate org.hibernate.annotations.Entity
Its individual attributes/values should become annotations.
Schedule for removal in 4.1
You should use @DynamicUpdate
instead
Here is a fixed JIRA talking about it.
Use the JPA @Entity annotation instead of the Hibernate @Entity annotation. Look in your imports, it should say
import javax.persistence.Entity;
and not
import org.hibernate.annotations.Entity;