I'm not sure that's the problem, but have you tried not putting any
@Column onto the QuestionResultsPK ?

Otherwise, browsing the code around that
ClassMetaData.validateAppIdClassPKs may help you understand better what
the message is trying to tell you?


-----Original Message-----
From: ericp56 [mailto:[EMAIL PROTECTED] 
Sent: mardi, 9. septembre 2008 18:56
To: users@openjpa.apache.org
Subject: PK Problem, mismatched property


I have three tables:
Question
id long (PK)
description string
etc.
Survey
id long (PK)
surveydate Date
etc.
QuestionResults
SurveyResultsID (FK)
QuestionID (FK)
Answer

Here's my class that won't persist, because of errors (to follow):

@Entity
@Table(name="QuestionResults")
@IdClass(QuestionResultsPK.class)
public class QuestionResults implements Serializable {

        private int answer;

        @Id
        @ManyToOne
        @JoinColumn(name="QuestionID")
        private QuestionProp questionid;

        @Id
        @ManyToOne
        @JoinColumn(name="SurveyResultsID")
        private SurveyResults surveyresultsid;
...

Here's the PK class:

@Embeddable
public class QuestionResultsPK implements Serializable {

        @Column(name="SurveyResultsID", insertable=false,
updatable=false)
        private SurveyResults surveyresultsid;

        @Column(name="QuestionID", insertable=false, updatable=false)
        private QuestionProp questionid;
...

Here's the error raised:
12:33:02,703 ERROR [Survey] Exception in WriteQuestionResult
12:33:02,703 ERROR [Survey] <openjpa-1.2.0-r422266:683325 fatal user
error>
org.apache.openjpa.persistence.ArgumentException: The id class specified
by type "class com.abc.ivr.survey.QuestionResults" does not match the
primary key fields of the class.  Make sure your identity class has the
same primary keys as your persistent type, including pk field types.
Mismatched property:
"questionid"
        at
org.apache.openjpa.meta.ClassMetaData.validateAppIdClassPKs(ClassMetaDat
a.java:1983)
        at
org.apache.openjpa.meta.ClassMetaData.validateAppIdClass(ClassMetaData.j
ava:1897)

I ported this code from a Swing/Tomcat application, but I was using
OpenJPA 1.1.  Now I am using OpenJPA 1.2 on Geronimo (a 2.1.4 build)

Any suggestions?

Thanks,

Eric
--
View this message in context:
http://n2.nabble.com/PK-Problem%2C-mismatched-property-tp1078084p1078084
.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


____________________________________________________________

• This email and any files transmitted with it are CONFIDENTIAL and intended
  solely for the use of the individual or entity to which they are addressed.
• Any unauthorized copying, disclosure, or distribution of the material within
  this email is strictly forbidden.
• Any views or opinions presented within this e-mail are solely those of the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
• An electronic message is not binding on its sender. Any message referring to
  a binding engagement must be confirmed in writing and duly signed.
• If you have received this email in error, please notify the sender immediately
  and delete the original.

Reply via email to