An Embedded class is a class whose instances are stored as part of an owning entity; it shares the identity of the owning entity. Each field of the embedded class is mapped to the database table associated with the owning entity.

To override the mapping information for a specific subclass, use the @AttributeOverride annotation for that specific class.

An embeddable entity is identified by the @Embeddable annotation.

Use this procedure to add embeddable persistence to an existing entity:

  1. Open the Java class in the Package Explorer.

  2. Select the class in the JPA Structure view.

  3. Click the mapping type hyperlink to open the Mapping Type Selection dialog.

  4. Select Embeddable and then click OK.

    Mapping Type Selection Dialog (Embeddable)

    The Mapping Type Selection dialog with Embeddable selected.
  5. Complete the remaining JPA Details view (for entities).


Related tasks
Adding persistence to a class
Specifying additional tables
Specifying entity inheritance