# Create ID mappings

Use an ID Mapping to specify the primary key of an entity. Each persistent entity must have an ID. Notice that the Problems view reports that each entity is missing an ID.

1. Select the Employee entity in the Package Explorer view.

2. Expand the Employee entity in the Persistence Outline view and select the id field. The Persistence Properties view (for attributes) displays the properties for the field.

3. In the Map As field, select ID.

   ID Mapping for emp_id Field

4. Use this table to complete the remaining fields on the General tab in the Persistence Properties view.

   Property | Description
   --- | ---
   Map As | Defines this mapping as an ID Mapping. Dali adds the `@Id` annotation to the entity.
   Column | The database column for the primary key of the table associated with the entity. Select EMP_ID. Because the database column (EMP_ID) is named differently than the entity field (id), Dali adds the `@Column(name="EMP_ID"`) annotation.

5. Leave all other fields on the tab as their defaults. Click the PK Generation tab.

   Primary Key Generation for emp_id Field

6. Use this table to complete the remaining fields on the General tab in the Persistence Properties view.

   Property | Description
   --- | ---
   Generated Value | These fields define how the primary key is generated.
   Strategy | For the tutorial project, use the Auto option.
   Generator Name | Leave this field blank.

In the Persistence Outline, the id field is identified as the primary key by the following icon:

Persistence Outline for Employee Entity

Repeat this procedure to map the following primary keys (as shown in Table: Tutorial Database Schema):

- The id field of the Address entity to the ADDRESS_ID column of the ADDRESS table.

- The number field of the PhoneNumber entity to the P_NUMBER column of the PHONE table.

Next, you will Create basic mappings.