Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325645 - EclipseLink defaults for join columns when there is a composite primary key
Summary: EclipseLink defaults for join columns when there is a composite primary key
Status: NEW
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JPA (show other bugs)
Version: 2.3   Edit
Hardware: PC Windows XP
: P2 enhancement (vote)
Target Milestone: Future   Edit
Assignee: Nan Li CLA
QA Contact:
URL:
Whiteboard: EclipseLink
Keywords:
Depends on:
Blocks: 341835
  Show dependency tree
 
Reported: 2010-09-17 15:12 EDT by Karen Butzke CLA
Modified: 2014-02-06 14:12 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karen Butzke CLA 2010-09-17 15:12:39 EDT
I am splitting up bug 314949 into 2 bugs.

EclipseLink defaults the joinColumns to id->id and id2->id2:

@Entity
@IdClass(BarIdClass.class)
public class Bar {
@Id
private int id;
@Id
private int id2;

@ElementCollection    
@CollectionTable(name="Foo")
private Map<String, String> foo;
}

If you are to specify any part of the CollectionTable joinColumns then you have to fully specify them, EclipseLink throws a validation error otherwise.
Comment 1 Nan Li CLA 2011-03-17 14:30:19 EDT
This is a problem related to the use of composite primary key on EclipseLink platform. Currently, if composite primary key is used, there's only one default join column pair is given with the default column names as null. We need to loop through the composite primary key to give the default join column pairs and set the default accordingly based on the EcliplseLink behavoir. EclipseLink defaults the joinColumns to id->id and id2->id2. 

We may need to create a new class saying EclipseLinkMappingTools to build the names of the default columns and the default referenced columns for EclipseLink platform.

The last problem described in the bug description will be track with bug 314949.
Comment 2 Nan Li CLA 2011-03-29 16:45:04 EDT
Based on the discussion, the implementation will be

1. keeping the current implementation for generic platform: 

   1) regular primary key: give the default name of column/referenced column based on the spec.
   2) composite primary key: give "null" as the default name of column/referenced column

2. creating a new implementation for EclipseLink platform:
   1) regular primary key: same as the generic platform
   2) composite primary key: build multiple default column/referenced column names based on the composite primary key defined, e.g., id1->id1 and id2->id2
Comment 3 Neil Hauge CLA 2011-07-01 16:24:14 EDT
Moving JPA specific bugs to new JPA component in bugzilla.
Comment 4 Neil Hauge CLA 2011-10-07 12:52:21 EDT
Targeting to Juno release.
Comment 5 Karen Butzke CLA 2012-03-22 17:34:50 EDT
Changing this to enhancment wince this is a feature of EclipseLink that is beyond the JPA spec. I think this it too big to implement at this stage in 3.2.
Comment 6 Neil Hauge CLA 2013-04-30 12:36:10 EDT
Deferred to 3.4.