Why annotation @Version type of javax.persistence.Version is being added to the entity if table contains timestamp field?

Solution Verified - Updated -

Issue

  • We use the maven command hibernate3:hbm2java to generate an Entity starting from a db table. When in a table there is the field timestamp, in the generated entity is added the annotation @Version (javax.persistence.Version).

  • Could you please explain us what is the function of this annotation and why it is generated? What should we do in order not to generate this annotation?

Environment

  • Hibernate

  • JPA

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.