Create basic mappings |
Use a Basic Mapping to map an attribute directly to a database column. In the Tutorial Object Model, the firstName field of the Employee class maps directly to the F_NAME column of the EMPLOYEE database table.
Select the Employee entity in the Package Explorer view.
In the JPA Structure view, select the firstName field of the Employee entity. The JPA Details view (for attributes) displays the properties for the field.
In the Map As field, select Basic. In the Column field, select F_NAME.
Dali adds the @Column(name="F_NAME")
annotation to the entity. In the JPA Structure, the firstName field is identified as a basic mapping as shown in the following figure:
Repeat this procedure to map each of the following fields as Basic mappings:
Employee entity
lastName field to L_NAME column
Address Entity
city field to CITY column
country field to COUNTRY column
postalCode field to P_CODE column
stateOrProvice field to PROVINCE column
street field to STREET column
Note: Because the city, country, and street fields are named identically to their database columns, Dali automatically maps the fields; no annotations are required. |
Phone Entity
areaCode field to AREA_CODE column
type field to TYPE column
Note: Because the type field is named identically to its database column, Dali automatically maps the field. No annotation is required. |
Next, you will Create one-to-one mappings.