You can use the @Embeddable
annotation to map an embedded class. An embeddable is a special type of class that is not directly persistent, but persisted only with its parent entity. An embeddable can be referenced from an entity or another embeddable using the @Embedded
annotation for a single reference, @EmbeddedId
for an embedded id, or the @ElementCollection
annotation for a Collection
or Map
reference. An embeddable can also be used in any Map
key using the @MapKeyClass
annotation.
@Embeddable
@EmbeddedId
@Embedded
@ElementCollection