Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362183 - Embedded of inherited Embeddable will not be mapped
Summary: Embedded of inherited Embeddable will not be mapped
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P2 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-27 07:43 EDT by Florian Wunderlich CLA
Modified: 2022-06-09 10:34 EDT (History)
2 users (show)

See Also:


Attachments
Test case to reproduce the problem (1.17 KB, application/x-zip)
2011-10-27 07:44 EDT, Florian Wunderlich CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Wunderlich CLA 2011-10-27 07:43:30 EDT
Build Identifier: 

This bug can be reproduced with EclipseLink-2.3.0.

If an Embeddable derives from an Embeddable which has an Embedded property, this Embedded property will not be mapped. It will be mapped when the superclass Embeddable is used, thus this is a problem in the implementation of bug 283028.

Suppose the following constellation:

An Embeddable "Primitive" defines a field "field".

An Embeddable "BasicEmbeddable" has a property of type "Primitive", which is annotated with Embedded.

An Embeddable "ExtendedEmbeddable" inherits from "BasicEmbeddable".

An Entity "TheEntity" contains "ExtendedEmbeddable".

The resulting table will NOT contain the field "field".

To simplify this a bit:

TheEntity refers to ExtendedEmbeddable inherits from BasicEmbeddable refers to Primitive

I will attach a test case with which the problem can be reproduced.

Reproducible: Always

Steps to Reproduce:
1. Extract test case and create a corresponding persistence.xml
2. Generate tables or do whatever is necessary to inspect the mappings
3. Notice that theentity only has a field "test", and is missing the field "field"
Comment 1 Florian Wunderlich CLA 2011-10-27 07:44:29 EDT
Created attachment 206067 [details]
Test case to reproduce the problem
Comment 2 Guy Pelletier CLA 2011-10-31 14:00:08 EDT
I think your issue lies in the double declaration of BasicEmbeddable, that is:

@Embeddable
@MappedSuperclass
public class BasicEmbeddable

The class can't be both an Embeddable and a MappedSuperclass. You should remove the @Embeddable declaration and have only the @MappedSuperclass.
Comment 3 Florian Wunderlich CLA 2011-11-01 07:05:21 EDT
(In reply to comment #2)
> I think your issue lies in the double declaration of BasicEmbeddable, that is:
> 
> @Embeddable
> @MappedSuperclass
> public class BasicEmbeddable
> 
> The class can't be both an Embeddable and a MappedSuperclass. You should remove
> the @Embeddable declaration and have only the @MappedSuperclass.

Doesn't matter. You can remove the @Embeddable, and the behavior is still the same. Column "field" is still missing.

On PostgreSQL:

CREATE TABLE theentity (
    id integer NOT NULL,
    test integer
);
Comment 4 Guy Pelletier CLA 2011-11-01 08:29:40 EDT
Outside of a DDL generation issue, is the mapping not available from the descriptor? That is, if you create the tables yourself are you able to persist TheEntity successfully?

Just trying to narrow down your issue. Have you tried moving the @Embedded mapping from BasicEmbeddable to ExtendedEmbeddable? Same issue?
Comment 5 Tom Ware CLA 2011-11-09 13:46:37 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:15:17 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:34:49 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink