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:

To create a basic mapping:

  1. In the Persistence Outline View, select the field to map. The Persistence Properties View (for Attributes) displays the properties for the selected field.

  2. In the Map As field, select Basic.

  3. Use this table to complete the remaining fields on the Persistence Properties view.

    Property Description Default
    Map As Defines this mapping as a Basic Mapping. Basic
    Column The database column associated with this entity attribute. By default, the Column is assumed to be named identically to the attribute.
    Fetch Type Defines how data is loaded from the database. See "Fetch Type" for details.
    • Eager

    • Lazy

    Eager
    Optional Specifies if this field is can be null. Yes

Eclipse adds the following annotations to the field:

@Column(name="<COLUMN>")
@Basic(fetch=FetchType.<FETCH_TYPE>, optional = <OPTIONAL>)

 

Related task

Mapping an Entity

 

Related reference

Persistence Outline View
Persistence Properties View (for Attributes)

 

Related concept

Understanding OR Mapping
Understanding JSR220: EJB 3.0