[jpa-spec users] Re: Embeddable and inheritance

From: Dirk Weil <>
Date: Mon, 1 Jul 2013 18:55:38 +0200

Hi Christian,


thank you for your answer. I’d like to use inheritance of embeddables just
in the second scenario, i. e. A extends B and the entity property is of type


I experienced that EclipseLink does not map the superclass attributes unless
B ist annotated @MappedSuperclass. Hibernate and openJPA seem to map
superclass attributes without any special annotation. AFIK relates the spec
@MappedSuperclass to entity classes only. Is it legal to use it on
embeddables? Is EclipLink spec-conform?


Thanks and regards



Von: Christian von Kutzleben []
Gesendet: Dienstag, 25. Juni 2013 09:59
Betreff: [jpa-spec users] Re: Embeddable and inheritance


Hi Dirk,

It depends, what you want to achieve:

JPA targets relational databases and embedded objects don't have
an identity on their own and are supposed to be mapped to the owners table
(single refs), or
the respective tables to be joined to the owners row (col/maps refs).

So polymorphism does not work, if this is, what you wanted to do, then the
answer would be "no".

If you don't plan to use polymorphism and only derive them for convenience,
then the answer would be "yes",
as an Embeddable class adheres to the same rules like an Entity (except
marked as embeddable rather then entity)



On Mon, Jun 24, 2013 at 11:26 PM, <> wrote:

Do embeddables allow inheritance, i. e. may an embeddable be derived
from some other embeddable?


Christian von Kutzleben
Chief Engineer | Versant GmbH
(T) +49 40 60990-0
(F) +49 40 60990-113
(E) <> |
GmbH is incorporated in Germany. Company registration number: HRB
54723, Amtsgericht Hamburg. Registered Office: Halenreie 42, 22359
Hamburg, Germany. Geschäftsführer: Bernhard Wöbker, Volker John
NOTICE: This e-mail message, including any attachments, is for the sole
use of the intended recipient(s) and may contain confidential or
proprietary information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient,
immediately contact the sender by reply e-mail and destroy all copies of
the original message.