One-to-one mapping

Use a One-to-One Mapping to define a relationship with one-to-many multiplicity.

  1. In the JPA Structure view, select the field to map.

  2. Right-click the field and then select Map As > One-to-One. The JPA Details view (for attributes) displays the properties for the selected.

    JPA Details, One-to-one Mapping

    JPA Details, One-to-one Mapping
  3. Complete each field in the One-to-One Mapping area.

  4. Complete the remaining areas in the JPA Details view (for attributes):

Eclipse adds the following annotations to the field:

@OneToOne(targetEntity=<TARGET_ENTITY>, =Type.<_TYPE>, 
    fetch = FetchType.<FETCH_TYPE>, mappedBy = "<MAPPED_BY>")
@JoinColumn(name="<JOIN_COLUMN_NAME>", referencedColumnName=
    updatable = <UPDATABLE>)

Related tasks

Related references

Related concepts