# Basic mapping

Use a Basic Mapping to map an attribute directly to a database column. Basic mappings may be used only with the following attribute types:

- Java primitive types and wrappers of the primitive types

- `java.lang.String, java.math.BigInteger`

- `java.math.BigDecimal`

- `java.util.Date`

- `java.util.Calendar, java.sql.Date`

- `java.sql.Time`

- `java.sql.Timestamp`

- `byte[]`

- `Byte[]`

- `char[]`

- `Character[]`

- enums

- any other type that implements `Serializable`

To create a basic mapping:

1. In the JPA Structure view, right-click the field to map. Select Map As > Basic. The JPA Details view (for attributes) displays the properties for the selected field.

   JPA Details, Basic mapping

2. Complete each field in the Basic Mapping area.

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

Eclipse adds the following annotations to the field:

    @Column(name="<COLUMN_NAME>", table="<COLUMN_TABLE>",
        insertable=<INSERTABLE>, updatable=<UPDATABLE>)
    @Basic(fetch=FetchType.<FETCH_TYPE>, optional = <OPTIONAL>)
    @Temporal(TemporalType.<TEMPORAL>)

Related tasks

- Mapping an entity

Related references

- JPA Structure view

- JPA Details view (for attributes)

Related concepts

- Understanding OR mappings

- Understanding Java Persistence API