Version mapping

Use a Version Mapping to specify the field used for optimistic locking. If the entity is associated with multiple tables, you should use a version mapping only with the primary table. You should have only a single version mapping per persistent entity. Version mappings may be used only with the following attribute types:

To create a version mapping:

  1. In the JPA Structure view, select the field to map. The JPA Details view (for attributes) displays the properties for the selected.

  2. In the Map As field, select Version.

  3. Use this table to complete the remaining fields in the JPA Details view.

    Property Description Default
    Column The database column mapped to the entity attribute. See "Column" for details. By default, the Column is assumed to be named identically to the attribute and always included in the INSERT and UPDATE statements.
    Table Name of the database table. This must be the primary table associated with the attribute's entity.
    Temporal Specifies the type of data. See "Temporal" for details.
    • Date

    • Time

    • Timestamp

Eclipse adds the following annotations to the field:

@Column(table="<COLUMN_TABLE>", name="<COLUMN_NAME>")


Related task

Mapping an entity


Related reference

JPA Structure view
JPA Details view (for attributes)


Related concept

Understanding OR mappings
Understanding EJB 3.0 Java Persistence API