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

Bug 313375

Summary: Need validation error on column specified on id mapped by a relationship
Product: z_Archived Reporter: Karen Butzke <karenfbutzke>
Component: EclipselinkAssignee: Project Inbox <eclipselink.orm-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Karen Butzke CLA 2010-05-18 11:18:47 EDT
I am using a recent build of EclipseLink build 2.1.0.v20100508-r7185. This example came from forum post http://www.eclipse.org/forums/index.php?t=msg&th=168159&start=0&

EclipseLink could give a validation error that the user specified a Column on the id mapping when a relationship is mapping that id. This column is ignored and instead the default join-column info is used. Dali gives the validation error : "In attribute 'id', a column is specified, but it is mapped by a relationship. IDs that are mapped by a relationship should not specify a column."


@Entity
public class Lead {
    @Id
    @Column(name="LeadId")
    private Integer id;

    @OneToOne(optional = false)
//  @JoinColumn(name = "LeadId")
    @MapsId("id")
    private Party party;  
}
@Entity
public class Party {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="PartyID")
	protected Integer id;
}
Comment 1 Eclipse Webmaster CLA 2022-06-09 10:10:26 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink