persistence@glassfish.java.net

Re: "Invalid composite primary key specification"

From: Markus Fuchs <Markus.Fuchs_at_Sun.COM>
Date: Wed, 08 Aug 2007 18:37:25 -0700
Hi Jeffrey,

I updated your entity classes. Please check the attached zip. Note, that I changed the parameter order in some of the methods. I still think that Preference needs a composite key consisting of name, entityId, and pageId.

-- markus.

Jeffrey Blattman wrote:
Markus Fuchs wrote:

Exception Description: The @JoinColumns on the annotated element [private com.sun.portal.pom.Entity com.sun.portal.pom.Preference.entity] from the entity class [class com.sun.portal.pom.Preference] is incomplete. When the source entity class uses a composite primary key, a @JoinColumn must be specified for each join column using the @JoinColumns. Both the name and the referenceColumnName elements must be specified in each such @JoinColumn.

Looks like you used @JoinColumn*s*. Please check.

no, i didn't. the message is telling me that i need to specify >1 @JoinColumn's, and use a @JoinColumns to contain them. i think.

You are completely right. I was confused. Could you please send us your entity classes. This would help very much in resolving your issue.


i'm attaching a .zip of the project. if you have the time, it'd be nice if you could confirm i'm doing this correctly. what i have *seems* to work, but i only have minimal test cases at this point.

please note that i have an entity class named "Entity", so sorry for the confusion on that.