Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 359408

Summary: @PrimaryKeyJoinColumn "name" attribute is ignored
Product: z_Archived Reporter: Ecmel Ercan <ecmel.ercan>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P4 CC: guy.pelletier
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Ecmel Ercan CLA 2011-09-29 08:06:39 EDT
Build Identifier: 2.3.0.v20110604-r9504

EclipseLink always uses the default name for a @PrimaryKeyJoinColumn even the column name is specified in the annotation.


Reproducible: Always
Comment 1 Guy Pelletier CLA 2011-09-29 10:21:01 EDT
Can you provide more details? How is your class mapped? Can you provide a snippet of your code?
Comment 2 Ecmel Ercan CLA 2011-09-29 10:28:29 EDT
public class User {

    @Id
    @Column(name = "cid")
    private String id;
}

public class Role {

    @Id
    @Column(name = "cid")
    private String id;
}

public class UserRole {

    @Id
    @PrimaryKeyJoinColumn(name = "cuserid")
    private User user;

    @Id
    @PrimaryKeyJoinColumn(name = "croleid")
    private Role role;
}

In this case EclipseLink assumes:

cuserid column name as USER.cid
croleid column name as ROLE.cid

Hope helps.
Comment 3 Guy Pelletier CLA 2011-09-29 10:40:08 EDT
A derived id mapping should use JoinColumn and not PrimaryKeyJoinColumn.
Comment 4 Guy Pelletier CLA 2011-09-29 11:10:45 EDT
Targeting as P4 future. Eclipselink could log a warning in this case.
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:30:30 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink