Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349401 - derived identifier of derived identifier
Summary: derived identifier of derived identifier
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: 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-06-15 02:42 EDT by jmilkiewicz CLA
Modified: 2022-06-09 10:34 EDT (History)
3 users (show)

See Also:


Attachments
sample maven-based project to reproduce the issue (5.39 KB, application/zip)
2011-06-15 05:39 EDT, jmilkiewicz CLA
no flags Details
stacktace (6.01 KB, text/plain)
2011-06-15 05:48 EDT, jmilkiewicz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description jmilkiewicz CLA 2011-06-15 02:42:25 EDT
Build Identifier: 

I want to create an entity with two Many2One references to other entities, and having PK being a composite of FK. The problem i got is when one of these references entities has a derived identifier (shared primary key) as well.

Reproducible: Always
Comment 1 jmilkiewicz CLA 2011-06-15 05:39:45 EDT
Created attachment 198006 [details]
sample maven-based project to reproduce the issue
Comment 2 jmilkiewicz CLA 2011-06-15 05:46:33 EDT
In attachement you can find an extracted standalone maven-based project to reporduce the issue. The original environments I faced the issue are GF 3.1 b40/GF 3.1 final which come with eclipselink 2.2.0.v20110114-r8831 and 2.2.0.v20110202-r8913 respectively.
Comment 3 jmilkiewicz CLA 2011-06-15 05:48:22 EDT
Created attachment 198008 [details]
stacktace
Comment 4 jmilkiewicz CLA 2011-06-15 05:59:20 EDT
In spite of the fact, I would like to have the mapping worked on GF 3.1 , i did a check the sample project with the newest version of eclipselink i could find on http://ftp.ing.umu.se/mirror/eclipse/rt/eclipselink/maven.repo/org/eclipse/persistence/eclipselink/ 2.4.0.v20110608-r9540 and the same exception is thrown
Comment 5 Guy Pelletier CLA 2011-06-16 15:04:19 EDT
Yes, looks like a valid issue. 

In the mean time, if you can, modifying the Dealer entity to map 'user' as an @Id rather than @MapsId should get you past the exception.

@OneToOne(cascade = CascadeType.ALL)
@Id
private AppUser user;
Comment 6 jmilkiewicz CLA 2011-06-17 06:42:10 EDT
Thx Guy. I followed your advice and it seems it works. 
Unfortunately, I had to modify a number of JPA-QL queries to accommodate this workaround since Dealer entity would lack of id property.On the other side looking at sql-generated queries it seems that modifications to JPA queries haven't changed them at all. I was worried that eclipse link will need to do an extra join with APPUSER table but this is not a case. 
Do you know any other consequences (beside of changing JPA queries) of using your approach to my original mapping?
Comment 7 Guy Pelletier CLA 2011-06-17 08:52:26 EDT
No, I can't think of any. The change you described was the only one I anticipated.

In the mean time, vote for this bug if you want to speed up the rate at which this bug is addressed. Your original configuration should be supported.
Comment 8 Tom Ware CLA 2011-06-23 10:17:46 EDT
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 9 Eclipse Webmaster CLA 2022-06-09 10:34:12 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink