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.

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

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

    JPA Details, Many-to-one mapping

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

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

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>, 
    =<_TYPE>
)

Related tasks

Related references

Related concepts