Many-to-One Mapping |
Use a Many-to-One mapping to defines a single-valued association to another entity class that has many-to-one multiplicity.
In the Persistence Outline View, select the field to map. The Persistence Properties View (for Attributes) displays the properties for the selected.
In the Map As field, select Many-to-One.
Use this table to complete the remaining fields on the Persistence Properties view.
Property | Description | Default |
---|---|---|
Target Entity | The entity to which this attribute is mapped. | null
You do not need to explicitly specify the target entity, since it can be inferred from the type of object being referenced. |
Cascade Type | See "Cascade Type" for details.
|
Default |
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 |
Join Table |
|
|
Name | Name of the join table |
|
Referenced Column |
|
|
Eclipse adds the following annotations to the field:
@JoinTable(joinColumns=@JoinColumn(name="<JOIN_COLUMN>"), name = "<JOIN_TABLE_NAME>") @ManyToOne(targetEntity=<TARGET_ENTITY>, fetch=<FETCH_TYPE>, cascade=<CASCADE_TYPE>)