Embeddable


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. Right-click the class in the Package Explorer and select Java Persistence > Make Java Persistence Entity.

    Adding Persistence to a Class

    Using the Persistence > Make Java Persistent Entity menu option.
  2. In the Persistence Properties view, use the Map As drop-list to select Embeddable.

    Selecting Embeddable Persistence

    Selecting embedded persistence on the Persistence Properties view.
  3. Complete the remaining Persistence Properties view (for entities).

 

Related tasks
Adding persistence to a class