Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359408 - @PrimaryKeyJoinColumn "name" attribute is ignored
Summary: @PrimaryKeyJoinColumn "name" attribute is ignored
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P4 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-29 08:06 EDT by Ecmel Ercan CLA
Modified: 2022-06-09 10:30 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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