I'm getting a strange exception when adding a detail record in the same commit
as the master record.
Both the master and detail records are defined in Oracle as having a primary
key consisting of the surrogate key plus “SUBMITDATE”. The Cayenne map shows
the primary key is just the surrogate keys.
The join between the two tables consist of the master tables surrogate key plus
the partition key (“SUBMITDATE”).
The submitDate field is set to the same value on both the master and detail
records before committing.
The log shows that the surrogate keys for both tables are generated from
sequences.
So why is Cayenne telling me that “SUBMITDATE” is a missing master key? Does
anyone have any advice?
I tried changing the join to be just the master table primary key, but that
didn't change the exception below.
Joe
--- transaction started.
SELECT PAYLOAD_SEQ.nextval FROM DUAL
SELECT PAYLOADERRDETAIL_SEQ.nextval FROM DUAL
INSERT INTO Payload (BATCHID, COMMANDNAME, COMMODITYTYPE, COMPRESSEDFLAG,
CREATIONDATE, DATAPAYLOAD, FLATFILEFLAG, HOST, LINENAME, PAYLOADID,
PROJECTCODE, REPROCESSID, SERIALNUMBER, SITE, STATUS, SUBMITDATE, UUID) VALUES
(?, ?, ?, ?, ?, EMPTY_BLOB(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[bind: 1:'JABL test data', 2:'SendModuleData', 3:'2', 4:NULL, 5:'2011-10-12
15:43:39.171', 6:'true', 7:'12.345.67.890', 8:NULL, 9:6, 10:'N20',
11:'2b99adcf-8244-40f3-b42a-669384...', 12:'SAAG4300DCMNxx', 13:'FXGL',
14:'ERROR', 15:'2011-07-01 14:05:32.0', 16:'9333fc51-3b08-4d06-8f8d-11e137...']
=== updated 1 row.
SELECT DATAPAYLOAD FROM Payload WHERE PAYLOADID = ? FOR UPDATE [bind: 1:6]
[write LOB: 1:<
3C,3F,78,6D,6C,20,76,65,72,73,69,6F,6E,3D,22,31,2E,30,22,20,65,6E,63,6F,64,69,6E,67,3D,22...>]
INSERT INTO PayloadErrDetail (CORRECTEDVALUE, ERRORCODE, FIELDNAME, FIELDVALUE,
PAYLOADERRDETAILID, PAYLOADID, SUBMITDATE) VALUES (?, ?, ?, ?, ?, ?, ?)
*** error.
org.apache.cayenne.CayenneRuntimeException: [v.3.1M3 Sep 12 2011 19:59:45]
Can't extract a master key. Missing key (SUBMITDATE), master ID
(<ObjectId:Payload, TEMP:0000004E2A21AEB9>)
at
org.apache.cayenne.access.DataDomainSyncBucket$PropagatedValueFactory.create(DataDomainSyncBucket.java:311)
~[cayenne-server-3.1M3.jar:na]