openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dick" <michael.d.d...@gmail.com>
Subject Re: PK Problem, mismatched property
Date Tue, 09 Sep 2008 21:52:20 GMT
Sorry, I probably didn't explain everything.

Changing the compound ID class (QuestionResultsPK) to use longs instead of
the entity types was the right thing to do. The fields of a compound ID
class should be one of the following types :
any Java primitive type; any primitive wrapper type; java.lang.String;
java.util.Date;java.sql.Date.

Having SurveyResultsID and QuestionID as fields in your compound ID class
lead to the first issue you encountered.

I don't think the new issue isn't directly related to the compound ID. I
suspect it has to do with the other entity classes.

For the new issue I assumed you're seeing SQL similar to this :
CREATE TABLE OPENJPA_SEQUENCE_TABLE (ID SMALLINT NOT NULL, SEQUENCE_VALUE
BIGINT, PRIMARY KEY (ID))

This is the OPENJPA_SEQ table I mentioned before. It's created automatically
by OpenJPA if this property is in your persistence.xml file :
            <property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema" />

If you haven't specified the openjpa.jdbc.SynchronizeMappings property and
you're using @GeneratedValues you'll get an error like this :
<openjpa-1.2.0-SNAPSHOT-r422266:683303 fatal general error>
org.apache.openjpa.persistence.PersistenceException: Table/View
'OPENJPA_SEQUENCE_TABLE' does not exist. {SELECT SEQUENCE_VALUE FROM
OPENJPA_SEQUENCE_TABLE WHERE ID = ? FOR UPDATE WITH RR} [code=20000,
state=42X05]
    at
org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4238)
    at
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4203)
    <snip>
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Table/View
'OPENJPA_SEQUENCE_TABLE' does not exist. {SELECT SEQUENCE_VALUE FROM
OPENJPA_SEQUENCE_TABLE WHERE ID = ? FOR UPDATE WITH RR} [code=20000,
state=42X05]
    at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:201)
     <snip>
NestedThrowables:
ERROR 42X05: Table/View 'OPENJPA_SEQUENCE_TABLE' does not exist.
    at org.apache.derby.iapi.error.StandardException.newException(Unknown
Source)

Of course I could be way off on my guess. If you're seeing something
entirely different ignore my comments about generated values.

-mike


On Tue, Sep 9, 2008 at 4:28 PM, ericp56 <eric.phetteplace@twcable.com>wrote:

>
> I forgot to mention:
> QuestionResults
> SurveyResultsID (FK) (PK)
> QuestionID (FK)(PK)
> Answer...
>
> The two ID fields are the primary key, they are the unique combination that
> identifies the entity.
>
> Why is OpenJPA not getting it?  Actually, what am I not getting?
> --
> View this message in context:
> http://n2.nabble.com/PK-Problem%2C-mismatched-property-tp1078084p1078622.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message