ID mapping |
Use an ID Mapping to specify the primary key of an entity. ID mappings may be used with a Persistent entity or Mapped superclass.
In the Persistence Outline view, select the field to map. The Persistence Properties view (for attributes) displays the properties for the selected.
In the Map As field, select ID.
Use this table to complete the remaining fields on the Persistence Properties view.
Property | Description | Default |
---|---|---|
Map As | Defines this mapping as an ID Mapping. | ID |
Columns | The database column (and its table) mapped to the entity attribute. See "Column" for details.
|
By default, the Column is assumed to be named identically to the attribute. |
Temporal | Specifies the type of data. See "Temporal" for details.
|
|
Generated Value | These fields define how the primary key is generated. |
|
Strategy | See "Generated Value" for details. | None (no generated value) |
Generator Name | Name of the primary key generator specified in the Strategy |
|
Additional fields will appear on the General tab, depending on the selected Strategy. See "Persistence Properties view (for attributes)" for additional information.
Eclipse adds the following annotations to the field:
@Id @Column(name="<COLUMN>") @GeneratedValue(strategy=GeneratorType.<STRATEGY>, generator = "<GENERATOR_NAME>") @Temporal(TemporalType.<TEMPORAL>)