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

Bug 323850

Summary: Primary key metadata issues
Product: z_Archived Reporter: Guy Pelletier <guy.pelletier>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: eclipselink.orm-inbox, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Porposed changes none

Description Guy Pelletier CLA 2010-08-27 11:42:35 EDT
I came across a couple issues in the PrimaryKeyMetadata class.

1 - The cacheKeyType is never read from the annotations. The following line should be added to the constructor for annotation processing:

m_cacheKeyType = (String) primaryKey.getAttribute("cacheKeyType");

2 - in the process method, the wrong validation exception is thrown if the user does not specify a name on one of the primary key columns, that is:

ValidationException.optimisticLockingSelectedColumnNamesNotSpecified(descriptor.getJavaClass());

A new exception should be created as this one does not make sense in this context and would be very confusing to the user.

Also, is the usage of a @PrimaryKey exclusive, in that it should not be used in conjunction with other JPA id mappings (@Id, @EmbeddedId, @IdClass, derived id's)? I suspect it does not make any sense for most but I don't see anything preventing users from doing this.
Comment 1 Tom Ware CLA 2010-09-13 10:33:13 EDT
Setting target and priority.  See the following page for information about what these settings mean:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 2 Guy Pelletier CLA 2010-10-27 10:21:06 EDT
I already corrected the first point in a previous transaction. I'll include a patch to correct the second point shortly.
Comment 3 Guy Pelletier CLA 2010-10-27 15:44:37 EDT
Created attachment 181871 [details]
Porposed changes
Comment 4 Guy Pelletier CLA 2010-10-27 16:01:06 EDT
Changes have been submitted.

Reviewed by: Chris Delahunt

Manually tested to verify the exception and new model change/addition to fieldaccess.advanced to test pk metadata override of mapped superclass.
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:19:47 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink