Embedded mapping

Use an Embedded Mapping to specify a persistent field or property of an entity whose value is an instance of an embeddable class.

  1. In the JPA Structure view, right-click the field to map.

  2. Select Map as > Embedded. The JPA Details view (for attributes) displays the properties for the selected field.

  3. Use this table to complete the remaining fields on the JPA Details view.

    Property Description Default
    Entity Mapping Hyperlnk Defines this mapping as a Embedded.

    This corresponds to the @Embedded annotation.

    Embedded
    Attribute Overrides Specify to override the default mapping of an entity's attribute. Select Override Default.
    Columns The database column (and its table) mapped to the entity attribute. See "Column" for details.
    • Name – Name of the database column.

    • Table – Name of the database table.



Eclipse adds the following annotations to the field:

@Embedded
@AttributeOverride(column=@Column(table="<COLUMN_TABLE>", name = "<COLUMN_NAME>"))

 

Related task

Mapping an entity

 

Related reference

JPA Structure view
JPA Details view (for attributes)

 

Related concept

Understanding OR mappings
Understanding EJB 3.0 Java Persistence API