persistence@glassfish.java.net

Re: "Invalid composite primary key specification"

From: Jeffrey Blattman <jeffrey.blattman_at_gmail.com>
Date: Thu, 09 Aug 2007 15:42:23 -0700

markus,

thank you very much for your help. i have a much better understanding of
the world now :)

p.s., it was not necessary to explicitly serialize/deserialize the
values ArrayList in Preference.

Markus Fuchs wrote:
> Hi Jeffrey,
>
> I had to modify the relationship definition in Preference.java again.
> Please also note, that the field Preference.values will be serialized
> by the persistence provider on save and must be deserialized on get.
>
> So much for now. Let me know if you have further questions.
>
> -- markus.
>
> Markus Fuchs wrote:
>> 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. W*hen 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 /_at_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.