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

Bug 315782

Summary: JPA2 derived identity metadata processing validation doesn't account for autoboxing
Product: z_Archived Reporter: Karen Butzke <karenfbutzke>
Component: EclipselinkAssignee: Guy Pelletier <guy.pelletier>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: eclipselink.orm-inbox, guy.pelletier, michael.f.obrien, nbryant, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed changes none

Description Karen Butzke CLA 2010-06-04 11:09:41 EDT
Found this while verifying Dali bug 308271, EclipseLink has the same issue.

@Entity
public class Parent {
    @Id Long id;
}

public class ChildPK implements Serializable {
    private long parent;
}

@Entity
@IdClass(ChildPK.class)
public class Child {
    @Id @ManyToOne
    private Parent parent;
}


Exception Description: The composite primary key attribute [parent] of type [null] on entity class [class model.Child] should be of the same type as defined on its primary key class [model.ChildPK]. That is, it should be of type [long].
	at org.eclipse.persistence.exceptions.ValidationException.invalidCompositePKAttribute(ValidationException.java:1143)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataDescriptor.validatePKClassId(MetadataDescriptor.java:1756)
Comment 1 Tom Ware CLA 2010-06-14 14:26:44 EDT
Setting target and priority.  See the following page for details of what these fields mean:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 2 Guy Pelletier CLA 2010-08-04 14:05:59 EDT
Created attachment 175859 [details]
Proposed changes
Comment 3 Guy Pelletier CLA 2010-08-04 14:30:47 EDT
Changes have been submitted.

Reviewed by: Tom Ware

Model change to expose the validation exception. With fix in place, exception does not occur and existing JPA FullRegressionTest and extended test suite passed successfully.
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:05:10 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink