JavaBeat

  • Home
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)
  • Privacy
  • Contact Us

Deprecated @Entity Annotation in Hibernate 4

December 25, 2013 by Krishna Srinivasan Leave a Comment

In the earlier versions of Hibernate, we use @Entity for marking a class as persistence entity in the database. It has list of attributes to be used as the parameters. @Entity has been deprecated from the hibernate 4 and will be removed from the hibernate 5.0 release. There is a confusion in the consistency of  information provided on their websites about the removal of these annotations. However, If you are using this annotation in the earlier versions of hibernate, you have to change before planning to migrate your project to higher versions. @Entity has the following list of attributes.

  1. dynamicInsert
  2. dynamicUpdate
  3. mutable
  4. optimisticLock
  5. persister
  6. polymorphism
  7. selectBeforeUpdate

When @Entity is removed, each and every attribute listed above will have its own annotation definition as listed below:

  1. DynamicInsert
  2. DynamicUpdate
  3. Immutable
  4. OptimisticLocking
  5. Persister
  6. Polymorphism
  7. SelectBeforeUpdate

However, the annotation Entity is deprecated in favor of the JPA annotation @javax.persistence.Entity. If you would like to use it, you have to use the JPA one instead of the hibernate annotation. It is obvious that there will be lot of changes with the hibernate API in the future versions, I would suggest to use the latest version if you are starting a new project.

Filed Under: Java Tagged With: Deprecated, Hibernate 4 Tutorials

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow Us

  • Facebook
  • Pinterest

As a participant in the Amazon Services LLC Associates Program, this site may earn from qualifying purchases. We may also earn commissions on purchases from other retail websites.

JavaBeat

FEATURED TUTORIALS

Answered: Using Java to Convert Int to String

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Copyright © by JavaBeat · All rights reserved