Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Embeddables and inheritance

Hi Laird,

I believe the confusion or interpretation may of stemed from the definition of the @Inheritance and @MappedSuperclass

"
The Inheritance annotation defines the inheritance strategy to be used for an entity class hierarchy. It is specified on the entity class that is the root of the entity class hierarchy.

The MappedSuperclass annotation designates a class whose mapping information is applied to the entities that inherit from it. A mapped superclass has no separate table defined for it.
"

However, internally Eclipselink can already support those configurations but you have to set them manually using a descriptor customizer. Please enter a bug to have this corrected by the metadata processing.

Cheers,
Guy

----- Original Message ----- From: Laird Nelson
To: EclipseLink User Discussions
Sent: Monday, August 03, 2009 11:24 AM
Subject: [eclipselink-users] Embeddables and inheritance


The specification says, with regard to @Embeddable classes:

Embeddable classes must adhere to the requirements specified in Section 2.1 for entities with the exception
that embeddable classes are not annotated as Entity.


Section 2.1.9, a sub-section of Section 2.1, and therefore included by it, includes the stanza:

An entity may inherit from another entity class.


That tells me that @Embeddables should be allowed to inherit from one another in exactly the same way that entities are allowed to inherit from one another.

I have one @Embeddable class (GeneralLedgerAccountIdentifier) that inherits from another (GeneralLedgerAccountType), and, at the moment, adds no additional state information (so no additional persistent fields, although I plan to add some later). I have another class that uses this @Embeddable as its primary key, via the @EmbeddedId annotation.

EclipseLink (1.1.2-SNAPSHOT) bombs out and says:

Exception Description: Entity [class ljn.GeneralLedgerAccount] uses [class ljn.GeneralLedgerAccountIdentifier] as embedded id class whose access-type has been determined as [FIELD]. But [class ljn.GeneralLedgerAccountIdentifier] does not define any [FIELD]. It is likely that you have not provided sufficient metadata in your id class [class ljn.GeneralLedgerAccountIdentifier].


Neither OpenJPA nor Hibernate have a problem with this particular construction and work properly in my opinion.

Should I file a bug, or is there a nuance in the specification I am not aware of that governs this case?

Thanks,
Laird




_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top