Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313375 - Need validation error on column specified on id mapped by a relationship
Summary: Need validation error on column specified on id mapped by a relationship
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-18 11:18 EDT by Karen Butzke CLA
Modified: 2022-06-09 10:10 EDT (History)
0 users

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-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