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:
In the Persistence Outline view, select the field to map. The Persistence Properties view (for attributes) displays the properties for the selected field.
In the Map As field, select Basic.
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 (and its table) mapped to the entity attribute. See See "Column" for details.
|
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 |
Optional | Specifies if this field is can be null. | Yes |
Temporal | Specifies the type of data. See "Temporal" for details.
|
|
Eclipse adds the following annotations to the field:
@Column(name="<COLUMN_NAME>", table="<COLUMN_TABLE>") @Basic(fetch=FetchType.<FETCH_TYPE>, optional = <OPTIONAL>) @Temporal(TemporalType.<TEMPORAL>)