One-to-one mapping |
Use a One-to-One Mapping to define a relationship with one-to-many multiplicity.
In the JPA Structure view, select the field to map. The JPA Details view (for attributes) displays the properties for the selected.
In the Map As field, select One-to-one.
Use this table to complete the General information fields in the JPA Details 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. |
Fetch Type | Defines how data is loaded from the database. See "Fetch Type" for details.
|
Eager |
Mapped By | The database field that owns the relationship. |
Use this table to complete the Join Columns Information fields in the JPA Details view.
Eclipse adds the following annotations to the field:
@OneToOne(targetEntity=<TARGET_ENTITY>, cascade=CascadeType.<CASCADE_TYPE>, fetch = FetchType.<FETCH_TYPE>, mappedBy = "<MAPPED_BY>") @JoinColumn(name="<JOIN_COLUMN_NAME>", referencedColumnName= "<JOIN_COLUMN_REFERENCED_COLUMN>", insertable = <INSERTABLE>, updatable = <UPDATABLE>)