Hi Dave,
MyDataObject is likely mapped to get its PK from the related "master"
object. The exception means that the "master" object does not yet have
a PK yet when MyDataObject is committed. So how is the PK generation
set for the master object entity? Are you using auto-incremented PKs
by any chance? Do you see the master saved before MyDataObject in the
SQL log?
Andrus
On Jul 30, 2008, at 11:43 PM, Dave Dombrosky wrote:
> I am currently getting a strange exception when trying to commit some
> objects to the db. I'm hoping someone here can help me figure it out.
>
> org.apache.cayenne.CayenneRuntimeException: [v.3.0-SNAPSHOT May 16
> 2008 12:28:23] Can't extract a master key. Missing key (id), master ID
> (<ObjectId:MyDataObject, TEMP:001A1A0065510101>)
> at org.apache.cayenne.access.DataDomainSyncBucket
> $PropagatedValueFactory.create(DataDomainSyncBucket.java:303)
> at org.apache.cayenne.query.BatchQuery.getValue(BatchQuery.java:
> 171)
> at
> org
> .apache
> .cayenne.query.InsertBatchQuery.getValue(InsertBatchQuery.java:62)
> at
> org
> .apache
> .cayenne
> .access
> .trans
> .InsertBatchQueryBuilder
> .getParameterValues(InsertBatchQueryBuilder.java:83)
> at
> org
> .apache.cayenne.access.jdbc.BatchAction.runAsBatch(BatchAction.java:
> 121)
> at
> org
> .apache
> .cayenne.access.jdbc.BatchAction.performAction(BatchAction.java:80)
> at
> org
> .apache
> .cayenne
> .access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:58)
> at
> org.apache.cayenne.access.DataNode.performQueries(DataNode.java:230)
> at
> org
> .apache
> .cayenne
> .access.DataDomainFlushAction.runQueries(DataDomainFlushAction.java:
> 227)
> at
> org
> .apache
> .cayenne
> .access.DataDomainFlushAction.flush(DataDomainFlushAction.java:145)
> at
> org.apache.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:821)
> at org.apache.cayenne.access.DataDomain
> $2.transform(DataDomain.java:788)
> at
> org
> .apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:
> 847)
> at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:
> 785)
> at
> org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:
> 1164)
> at
> org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:
> 1066)
>
> Any idea what this means? I'm using some 1:1 mappings on the PK of
> this table, and also some cayenne inheritance, so it's possible I set
> something up wrong.
>
> -Dave
>
This archive was generated by hypermail 2.0.0 : Thu Jul 31 2008 - 14:22:01 EDT