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.

  2. Right-click the field and then select Map As > Version. The JPA Details view (for attributes) displays the properties for the selected.

    JPA Details, Version Mapping

    JPA Details, Version Mapping
  3. Complete each field in the Version Mapping area.

  4. Complete the remaining areas in the JPA Details view (for attributes):

Eclipse adds the following annotations to the field:

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

Related tasks

Related references

Related concepts