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.
Right-click the field and then select Map As > One-to-One. The JPA Details view (for attributes) displays the properties for the selected.
Use this table to complete the General information fields in the JPA Details view.
Property | Description | Default |
---|---|---|
Mapped Entity Hyperlink | Defines mapping as One-to-One. This corresponds to the @OneToOne annotation. |
One-to-One |
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>)