You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Mike Kienenberger <mk...@gmail.com> on 2006/04/11 03:56:35 UTC

Some parts of FK are missing in snapshot, join:

What would cause the following exception (latest cvs checkout)?

It doesn't seem to happen deterministically.   I'm converting data
records from one format to another, reading a set of records in, and
then creating new set of records to write out.

The first record always seems to work.   Then I always get this error
soon afterward.  Sometimes on the second set of records, sometimes a
few later.   On this particular run, I got it 5 record sets into the
conversion.

I dumped all of the uncommitted objects in the datacontext before
doing the saveChanges, and that's what the "Leftover object" messages
are showing.

I've edited the attributes, hopefully leaving only the relevent ones.

To the best of my knowledge, the Join in question is the relationship
from <ObjectId:WomsWork, TEMP:00004C96C5030161> to
<ObjectId:StatusableWork, TEMP:00004D96C5030161>, both of which exist
and are in state new.

This relationship is in my DataMap as

	<db-relationship name="statusableWork" source="WOMS_WORK"
target="STATUSABLE_WORK" toMany="false">
		<db-attribute-pair source="WOMS_WORK_ID" target="ID"/>
	</db-relationship>

The reverse relationship is in another DataMap as

	<db-relationship name="womsWork" source="STATUSABLE_WORK"
target="WOMS_WORK" toDependentPK="true" toMany="true">
		<db-attribute-pair source="ID" target="WOMS_WORK_ID"/>
	</db-relationship>

And the id for WOMS_WORK is dependent on the ID for STATUSABLE work
(which is in turn dependent upon the ID for WORK -- vertical
inheritance)

[I changed toMany from true to false in the second db-relationship as
that was an error I just noticed, but it hasn't made any difference].

Leftover new object: {<ObjectId:Contact, TEMP:00005496CDEC0161>; new;
Leftover new object: {<ObjectId:StatusableWork,
TEMP:00005D96CEF60161>; new; [parentWork=>{<ObjectId:Work,
TEMP:00004E96C5030161>}; work=>{<ObjectId:Work,
TEMP:00005E96CEF60161>}; ]}
Leftover new object: {<ObjectId:Work, TEMP:00004E96C5030161>; new;
[workType=>{<ObjectId:WorkType, ID=1042>};
statusableWorkList=>{<ObjectId:StatusableWork,
TEMP:00004D96C5030161>}; ]}
Leftover new object: {<ObjectId:StatusableWork,
TEMP:00004D96C5030161>; new; [work=>{<ObjectId:Work,
TEMP:00004E96C5030161>}; ]}
Leftover new object: {<ObjectId:Fee, TEMP:00005296CAEF0161>; new;
Leftover new object: {<ObjectId:ContactName, TEMP:00005396CDEC0161>; new;
Leftover new object: {<ObjectId:Work, TEMP:00005B96CEF60161>; new;
[workType=>{<ObjectId:WorkType, ID=1056>};
statusableWorkList=>{<ObjectId:StatusableWork,
TEMP:00005A96CEF60161>}; ]}
Leftover new object: {<ObjectId:StatusableWork,
TEMP:00005A96CEF60161>; new; [parentWork=>{<ObjectId:Work,
TEMP:00004E96C5030161>}; work=>{<ObjectId:Work,
TEMP:00005B96CEF60161>}; ]}
Leftover new object: {<ObjectId:FeePaymentReceipt, TEMP:00005196CAEF0161>; new;
Leftover new object: {<ObjectId:Address, TEMP:00005596CE0C0161>; new;
Leftover new object: {<ObjectId:Work, TEMP:00005E96CEF60161>; new;
[statusableWorkList=>{<ObjectId:StatusableWork,
TEMP:00005D96CEF60161>}; ]}
Leftover new object: {<ObjectId:WomsWork, TEMP:00004C96C5030161>; new;
[statusableWork=>{<ObjectId:StatusableWork, TEMP:00004D96C5030161>};
]}
Leftover new object: {<ObjectId:StatusHistory, TEMP:00004F96C5030161>; new;
Leftover new object: {<ObjectId:StatusableWork,
TEMP:00005896CE1B0161>; new; [parentWork=>{<ObjectId:Work,
TEMP:00004E96C5030161>}; work=>{<ObjectId:Work,
TEMP:00005996CE1B0161>}; ]}
Leftover new object: {<ObjectId:Phone, TEMP:00005796CE1B0161>; new;
Leftover new object: {<ObjectId:WorkAssignee, TEMP:00005C96CEF60161>;
new; [statusableWork=>{<ObjectId:StatusableWork,
TEMP:00005A96CEF60161>}; seq=>1; role=>{<ObjectId:SecRole,
ID=20527>}]}
Leftover new object: {<ObjectId:Fee, TEMP:00005096CAEF0161>; new;
Leftover new object: {<ObjectId:WorkAssignee, TEMP:00005F96CEF60161>;
new; [statusableWork=>{<ObjectId:StatusableWork,
TEMP:00005D96CEF60161>}; seq=>1; role=>{<ObjectId:SecRole,
ID=21466>}]}
Leftover new object: {<ObjectId:Work, TEMP:00005996CE1B0161>; new;
[statusableWorkList=>{<ObjectId:StatusableWork,
TEMP:00005896CE1B0161>}; ]}
Leftover new object: {<ObjectId:Address, TEMP:00005696CE1B0161>; new;
Leftover modified object: {<ObjectId:WorkType, ID=1042>; modified;
Leftover modified object: {<ObjectId:StateProvince,
STATE_PROVINCE_ID=1>; modified;
Leftover modified object: {<ObjectId:WorkType, ID=1053>; modified;
Leftover modified object: {<ObjectId:WorkType, ID=1057>; modified;
Leftover modified object: {<ObjectId:Status, ID=112>; modified;
Leftover modified object: {<ObjectId:WorkType, ID=1056>; modified;

org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2-dev April 10
2006] Some parts of FK are missing in snapshot, join:
org.objectstyle.cayenne.map.DbJoin@ec898a[source=WOMS_WORK_ID,target=ID]
	at org.objectstyle.cayenne.access.DataNodePKGenerationAction.appendPkFromMasterRelationships(DataNodePKGenerationAction.java:250)
	at org.objectstyle.cayenne.access.DataNodePKGenerationAction.createPermIdsForObjEntity(DataNodePKGenerationAction.java:143)
	at org.objectstyle.cayenne.access.DataNodeInsertBucket.createPrimaryKey(DataNodeInsertBucket.java:97)
	at org.objectstyle.cayenne.access.DataNodeFlushAction.createPK(DataNodeFlushAction.java:106)
	at org.objectstyle.cayenne.access.DataDomainFlushAction.preprocess(DataDomainFlushAction.java:217)
	at org.objectstyle.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:148)
	at org.objectstyle.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:778)
	at org.objectstyle.cayenne.access.DataDomain$2.transform(DataDomain.java:749)
	at org.objectstyle.cayenne.access.DataDomain.runInTransaction(DataDomain.java:804)
	at org.objectstyle.cayenne.access.DataDomain.onSync(DataDomain.java:746)
	at org.objectstyle.cayenne.access.DataContext.flushToParent(DataContext.java:1217)
	at org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1121)

Re: Some parts of FK are missing in snapshot, join:

Posted by Mike Kienenberger <mk...@gmail.com>.
On 4/11/06, Andrus Adamchik <an...@objectstyle.org> wrote:
> Also do you know if this happened with 1.1 or early 1.2 milestones (<
> M10), i.e. before we've changed the commit code?

Looks like it broke between M11 and M12.   Works M9 through M11, but
breaks on M12, B1, and current.

Re: Some parts of FK are missing in snapshot, join:

Posted by Mike Kienenberger <mk...@gmail.com>.
Andrus,

http://objectstyle.org/jira/browse/CAY-501 should contain everything
needed to duplicate the issue.   All you'd need to do is load the
model, point the two data maps to a database, and generate the empty
schema, then run the demo class.   Everything unpacks into the "demo"
package in your classpath.

Let me know if there's anything further I can do to help with this.

Note that the only "strange" thing happening is using
setPersistenceState() to model inheritance, but this has worked
without issue in past versions of Cayenne.

On 4/11/06, Mike Kienenberger <mk...@gmail.com> wrote:
> On 4/11/06, Andrus Adamchik <an...@objectstyle.org> wrote:
> > Yeah, if you could extract a reproducible subset, it would be great.
>
> Yes, I have now reduced this down to a trivial model containing only
> WOMS_WORK, STATUSABLE_WORK, and WORK, each of which contains only an
> ID primary key field.
>
>
> > >> Also do you know if this happened with 1.1 or early 1.2 milestones (<
> > >> M10), i.e. before we've changed the commit code?
> >
> > Don't spend much time on that - I was just trying to narrow down the
> > possibilities by comparing old and new commit code, but this is
> > really unimportant.
>
> Well, it was worth trying anyway as I wanted to run my conversion,
> even if it meant using an older version of Cayenne.   Unfortunately,
> the differences between HSQLDB 1.8 and 1.7 make it next to impossible
> to "downgrade" at this point.
>

Re: Some parts of FK are missing in snapshot, join:

Posted by Mike Kienenberger <mk...@gmail.com>.
On 4/11/06, Andrus Adamchik <an...@objectstyle.org> wrote:
> Yeah, if you could extract a reproducible subset, it would be great.

Yes, I have now reduced this down to a trivial model containing only
WOMS_WORK, STATUSABLE_WORK, and WORK, each of which contains only an
ID primary key field.


> >> Also do you know if this happened with 1.1 or early 1.2 milestones (<
> >> M10), i.e. before we've changed the commit code?
>
> Don't spend much time on that - I was just trying to narrow down the
> possibilities by comparing old and new commit code, but this is
> really unimportant.

Well, it was worth trying anyway as I wanted to run my conversion,
even if it meant using an older version of Cayenne.   Unfortunately,
the differences between HSQLDB 1.8 and 1.7 make it next to impossible
to "downgrade" at this point.

Re: Some parts of FK are missing in snapshot, join:

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Apr 11, 2006, at 6:01 PM, Mike Kienenberger wrote:

> On 4/11/06, Andrus Adamchik <an...@objectstyle.org> wrote:
>> I suspect the unpredictable nature of the error is due to incorrect
>> dependency sorting during key generation (this is just a guess, but
>> it seems likely). If possible, could you open a Jira issue with a
>> DataMap file attached.
>
> Well, there's 4 large datamaps involved.   I'll see what I can do.

Yeah, if you could extract a reproducible subset, it would be great.


>> Also do you know if this happened with 1.1 or early 1.2 milestones (<
>> M10), i.e. before we've changed the commit code?
>
> No, I haven't tried this with anything but the latest svn.
> At what point did the modeler switch to 1.8.0 hsqldb-based
> preferences?  I can go back and test any of the milestones up to that
> point, but it'd be a pain to try to get 1.7 preferences working again,
> now that I've updated my databases to 1.8.
>
> I suppose I can drop the JDNI config and go back to a file-based
> driver file to do some testing.   I'll let you know.

Don't spend much time on that - I was just trying to narrow down the  
possibilities by comparing old and new commit code, but this is  
really unimportant.

Andrus

Re: Some parts of FK are missing in snapshot, join:

Posted by Mike Kienenberger <mk...@gmail.com>.
On 4/11/06, Andrus Adamchik <an...@objectstyle.org> wrote:
> I suspect the unpredictable nature of the error is due to incorrect
> dependency sorting during key generation (this is just a guess, but
> it seems likely). If possible, could you open a Jira issue with a
> DataMap file attached.

Well, there's 4 large datamaps involved.   I'll see what I can do.

> Also do you know if this happened with 1.1 or early 1.2 milestones (<
> M10), i.e. before we've changed the commit code?

No, I haven't tried this with anything but the latest svn.
At what point did the modeler switch to 1.8.0 hsqldb-based
preferences?  I can go back and test any of the milestones up to that
point, but it'd be a pain to try to get 1.7 preferences working again,
now that I've updated my databases to 1.8.

I suppose I can drop the JDNI config and go back to a file-based
driver file to do some testing.   I'll let you know.

Re: Some parts of FK are missing in snapshot, join:

Posted by Andrus Adamchik <an...@objectstyle.org>.
Mike,

I suspect the unpredictable nature of the error is due to incorrect  
dependency sorting during key generation (this is just a guess, but  
it seems likely). If possible, could you open a Jira issue with a  
DataMap file attached.

Also do you know if this happened with 1.1 or early 1.2 milestones (<  
M10), i.e. before we've changed the commit code?

Andrus


On Apr 11, 2006, at 6:02 AM, Mike Kienenberger wrote:

> Here's a simpler example (from after changing the to-many value).
> This was the second set of objects converted -- the first set
> converted fine.   This data set also converted fine in the previous
> run.  This example was simple enough that I didn't edit any of the
> output below.
>
> There is only WOMS_WORK which inherits from STATUSABLE_WORK which
> inherits from WORK, each of which exist only once.   It's the
> relationship between WOMS_WORK and STATUSABLE_WORK which is involved
> in the error.
>
> Leftover new object: {<ObjectId:WomsWork, TEMP:000005AB83030161>; new;
> [isUrd=>null; statusableWork=>{<ObjectId:StatusableWork,
> TEMP:000006AB83030161>}; isPoles=>null; feeList=>(..); parcel=>?;
> doesBuildingExist=>null; isYardPole=>null; bidPrice=>0;
> cityPermitReceivedDate=>null; isCityInspectionRequired=>null;
> laborEstimate=>0; numberOfMeters=>null; materialsEstimate=>0]}
> Leftover new object: {<ObjectId:Fee, TEMP:000008AB891D0161>; new;
> [feePaymentReceiptList=>(..); womsWorkList=>(..);
> requiredDepositAmountDue=>null; amountDue=>null]}
> Leftover new object: {<ObjectId:FeePaymentReceipt,
> TEMP:000009AB891D0161>; new; [amountPaid=>0; fee=>{<ObjectId:Fee,
> TEMP:000008AB891D0161>}; receiptNumber=>null; datePaid=>null]}
> Leftover new object: {<ObjectId:Work, TEMP:000007AB83030161>; new;
> [workType=>{<ObjectId:WorkType, ID=1042>};
> statusableWorkList=>{<ObjectId:StatusableWork,
> TEMP:000006AB83030161>}; workOptionList=>?; objType=>ENG;
> userHoursList=>?]}
> Leftover new object: {<ObjectId:Fee, TEMP:00000AAB891D0161>; new;
> [feePaymentReceiptList=>?; womsWorkList=>(..);
> requiredDepositAmountDue=>0; amountDue=>null]}
> Leftover new object: {<ObjectId:StatusableWork,
> TEMP:000006AB83030161>; new; [expectedCompletionDate=>null;
> work=>{<ObjectId:Work, TEMP:000007AB83030161>};
> requestedCompDate=>null; workAssigneeList=>?;
> problemDescription=>null; rankList=>?; attachmentList=>?;
> solutionDescription=>null; externalSystemKey=>0;
> statusHistoryList=>?]}
> Leftover modified object: {<ObjectId:WorkType, ID=1042>; modified;
> [isAssignable=>Y; parentWorkType=>{<ObjectId:WorkType, ID=1000>};
> workOptionTypeList=>?; childrenWorkTypeList=>?; description=>null;
> isActive=>Y; statusList=>?; objType=>null; workList=>(..); name=>T&D
> Work Order]}
> --- will run 2 queries.
> --- transaction started.
> SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME =  
> 'FEE_PAYMENT_RECEIPT'
> === returned 1 row. - took 0 ms.
> UPDATE AUTO_PK_SUPPORT SET NEXT_ID = NEXT_ID + 20 WHERE TABLE_NAME =
> 'FEE_PAYMENT_RECEIPT'
> === updated 1 row.
> org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2-dev April 10
> 2006] Some parts of FK are missing in snapshot, join:
> org.objectstyle.cayenne.map.DbJoin@1786a3c 
> [source=WOMS_WORK_ID,target=ID]
> 	at  
> org.objectstyle.cayenne.access.DataNodePKGenerationAction.appendPkFrom 
> MasterRelationships(DataNodePKGenerationAction.java:250)
> 	at  
> org.objectstyle.cayenne.access.DataNodePKGenerationAction.createPermId 
> sForObjEntity(DataNodePKGenerationAction.java:143)
> 	at  
> org.objectstyle.cayenne.access.DataNodeInsertBucket.createPrimaryKey 
> (DataNodeInsertBucket.java:97)
> 	at org.objectstyle.cayenne.access.DataNodeFlushAction.createPK 
> (DataNodeFlushAction.java:106)
> 	at org.objectstyle.cayenne.access.DataDomainFlushAction.preprocess 
> (DataDomainFlushAction.java:217)
> 	at org.objectstyle.cayenne.access.DataDomainFlushAction.flush 
> (DataDomainFlushAction.java:148)
> 	at org.objectstyle.cayenne.access.DataDomain.onSyncFlush 
> (DataDomain.java:778)
> 	at org.objectstyle.cayenne.access.DataDomain$2.transform 
> (DataDomain.java:749)
> 	at org.objectstyle.cayenne.access.DataDomain.runInTransaction 
> (DataDomain.java:804)
> 	at org.objectstyle.cayenne.access.DataDomain.onSync 
> (DataDomain.java:746)
> 	at org.objectstyle.cayenne.access.DataContext.flushToParent 
> (DataContext.java:1217)
> 	at org.objectstyle.cayenne.access.DataContext.commitChanges 
> (DataContext.java:1121)
>
>
>
> On 4/10/06, Mike Kienenberger <mk...@gmail.com> wrote:
>> What would cause the following exception (latest cvs checkout)?
>>
>> It doesn't seem to happen deterministically.   I'm converting data
>> records from one format to another, reading a set of records in, and
>> then creating new set of records to write out.
>>
>> The first record always seems to work.   Then I always get this error
>> soon afterward.  Sometimes on the second set of records, sometimes a
>> few later.   On this particular run, I got it 5 record sets into the
>> conversion.
>>
>> I dumped all of the uncommitted objects in the datacontext before
>> doing the saveChanges, and that's what the "Leftover object" messages
>> are showing.
>>
>> I've edited the attributes, hopefully leaving only the relevent ones.
>>
>> To the best of my knowledge, the Join in question is the relationship
>> from <ObjectId:WomsWork, TEMP:00004C96C5030161> to
>> <ObjectId:StatusableWork, TEMP:00004D96C5030161>, both of which exist
>> and are in state new.
>>
>> This relationship is in my DataMap as
>>
>>         <db-relationship name="statusableWork" source="WOMS_WORK"
>> target="STATUSABLE_WORK" toMany="false">
>>                 <db-attribute-pair source="WOMS_WORK_ID"  
>> target="ID"/>
>>         </db-relationship>
>>
>> The reverse relationship is in another DataMap as
>>
>>         <db-relationship name="womsWork" source="STATUSABLE_WORK"
>> target="WOMS_WORK" toDependentPK="true" toMany="true">
>>                 <db-attribute-pair source="ID"  
>> target="WOMS_WORK_ID"/>
>>         </db-relationship>
>>
>> And the id for WOMS_WORK is dependent on the ID for STATUSABLE work
>> (which is in turn dependent upon the ID for WORK -- vertical
>> inheritance)
>>
>> [I changed toMany from true to false in the second db-relationship as
>> that was an error I just noticed, but it hasn't made any difference].
>>
>> Leftover new object: {<ObjectId:Contact, TEMP:00005496CDEC0161>; new;
>> Leftover new object: {<ObjectId:StatusableWork,
>> TEMP:00005D96CEF60161>; new; [parentWork=>{<ObjectId:Work,
>> TEMP:00004E96C5030161>}; work=>{<ObjectId:Work,
>> TEMP:00005E96CEF60161>}; ]}
>> Leftover new object: {<ObjectId:Work, TEMP:00004E96C5030161>; new;
>> [workType=>{<ObjectId:WorkType, ID=1042>};
>> statusableWorkList=>{<ObjectId:StatusableWork,
>> TEMP:00004D96C5030161>}; ]}
>> Leftover new object: {<ObjectId:StatusableWork,
>> TEMP:00004D96C5030161>; new; [work=>{<ObjectId:Work,
>> TEMP:00004E96C5030161>}; ]}
>> Leftover new object: {<ObjectId:Fee, TEMP:00005296CAEF0161>; new;
>> Leftover new object: {<ObjectId:ContactName, TEMP: 
>> 00005396CDEC0161>; new;
>> Leftover new object: {<ObjectId:Work, TEMP:00005B96CEF60161>; new;
>> [workType=>{<ObjectId:WorkType, ID=1056>};
>> statusableWorkList=>{<ObjectId:StatusableWork,
>> TEMP:00005A96CEF60161>}; ]}
>> Leftover new object: {<ObjectId:StatusableWork,
>> TEMP:00005A96CEF60161>; new; [parentWork=>{<ObjectId:Work,
>> TEMP:00004E96C5030161>}; work=>{<ObjectId:Work,
>> TEMP:00005B96CEF60161>}; ]}
>> Leftover new object: {<ObjectId:FeePaymentReceipt, TEMP: 
>> 00005196CAEF0161>; new;
>> Leftover new object: {<ObjectId:Address, TEMP:00005596CE0C0161>; new;
>> Leftover new object: {<ObjectId:Work, TEMP:00005E96CEF60161>; new;
>> [statusableWorkList=>{<ObjectId:StatusableWork,
>> TEMP:00005D96CEF60161>}; ]}
>> Leftover new object: {<ObjectId:WomsWork, TEMP:00004C96C5030161>;  
>> new;
>> [statusableWork=>{<ObjectId:StatusableWork, TEMP:00004D96C5030161>};
>> ]}
>> Leftover new object: {<ObjectId:StatusHistory, TEMP: 
>> 00004F96C5030161>; new;
>> Leftover new object: {<ObjectId:StatusableWork,
>> TEMP:00005896CE1B0161>; new; [parentWork=>{<ObjectId:Work,
>> TEMP:00004E96C5030161>}; work=>{<ObjectId:Work,
>> TEMP:00005996CE1B0161>}; ]}
>> Leftover new object: {<ObjectId:Phone, TEMP:00005796CE1B0161>; new;
>> Leftover new object: {<ObjectId:WorkAssignee, TEMP:00005C96CEF60161>;
>> new; [statusableWork=>{<ObjectId:StatusableWork,
>> TEMP:00005A96CEF60161>}; seq=>1; role=>{<ObjectId:SecRole,
>> ID=20527>}]}
>> Leftover new object: {<ObjectId:Fee, TEMP:00005096CAEF0161>; new;
>> Leftover new object: {<ObjectId:WorkAssignee, TEMP:00005F96CEF60161>;
>> new; [statusableWork=>{<ObjectId:StatusableWork,
>> TEMP:00005D96CEF60161>}; seq=>1; role=>{<ObjectId:SecRole,
>> ID=21466>}]}
>> Leftover new object: {<ObjectId:Work, TEMP:00005996CE1B0161>; new;
>> [statusableWorkList=>{<ObjectId:StatusableWork,
>> TEMP:00005896CE1B0161>}; ]}
>> Leftover new object: {<ObjectId:Address, TEMP:00005696CE1B0161>; new;
>> Leftover modified object: {<ObjectId:WorkType, ID=1042>; modified;
>> Leftover modified object: {<ObjectId:StateProvince,
>> STATE_PROVINCE_ID=1>; modified;
>> Leftover modified object: {<ObjectId:WorkType, ID=1053>; modified;
>> Leftover modified object: {<ObjectId:WorkType, ID=1057>; modified;
>> Leftover modified object: {<ObjectId:Status, ID=112>; modified;
>> Leftover modified object: {<ObjectId:WorkType, ID=1056>; modified;
>>
>> org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2-dev April 10
>> 2006] Some parts of FK are missing in snapshot, join:
>> org.objectstyle.cayenne.map.DbJoin@ec898a 
>> [source=WOMS_WORK_ID,target=ID]
>>         at  
>> org.objectstyle.cayenne.access.DataNodePKGenerationAction.appendPkFro 
>> mMasterRelationships(DataNodePKGenerationAction.java:250)
>>         at  
>> org.objectstyle.cayenne.access.DataNodePKGenerationAction.createPermI 
>> dsForObjEntity(DataNodePKGenerationAction.java:143)
>>         at  
>> org.objectstyle.cayenne.access.DataNodeInsertBucket.createPrimaryKey( 
>> DataNodeInsertBucket.java:97)
>>         at  
>> org.objectstyle.cayenne.access.DataNodeFlushAction.createPK 
>> (DataNodeFlushAction.java:106)
>>         at  
>> org.objectstyle.cayenne.access.DataDomainFlushAction.preprocess 
>> (DataDomainFlushAction.java:217)
>>         at  
>> org.objectstyle.cayenne.access.DataDomainFlushAction.flush 
>> (DataDomainFlushAction.java:148)
>>         at org.objectstyle.cayenne.access.DataDomain.onSyncFlush 
>> (DataDomain.java:778)
>>         at org.objectstyle.cayenne.access.DataDomain$2.transform 
>> (DataDomain.java:749)
>>         at  
>> org.objectstyle.cayenne.access.DataDomain.runInTransaction 
>> (DataDomain.java:804)
>>         at org.objectstyle.cayenne.access.DataDomain.onSync 
>> (DataDomain.java:746)
>>         at org.objectstyle.cayenne.access.DataContext.flushToParent 
>> (DataContext.java:1217)
>>         at org.objectstyle.cayenne.access.DataContext.commitChanges 
>> (DataContext.java:1121)
>>
>


Re: Some parts of FK are missing in snapshot, join:

Posted by Mike Kienenberger <mk...@gmail.com>.
Here's a simpler example (from after changing the to-many value). 
This was the second set of objects converted -- the first set
converted fine.   This data set also converted fine in the previous
run.  This example was simple enough that I didn't edit any of the
output below.

There is only WOMS_WORK which inherits from STATUSABLE_WORK which
inherits from WORK, each of which exist only once.   It's the
relationship between WOMS_WORK and STATUSABLE_WORK which is involved
in the error.

Leftover new object: {<ObjectId:WomsWork, TEMP:000005AB83030161>; new;
[isUrd=>null; statusableWork=>{<ObjectId:StatusableWork,
TEMP:000006AB83030161>}; isPoles=>null; feeList=>(..); parcel=>?;
doesBuildingExist=>null; isYardPole=>null; bidPrice=>0;
cityPermitReceivedDate=>null; isCityInspectionRequired=>null;
laborEstimate=>0; numberOfMeters=>null; materialsEstimate=>0]}
Leftover new object: {<ObjectId:Fee, TEMP:000008AB891D0161>; new;
[feePaymentReceiptList=>(..); womsWorkList=>(..);
requiredDepositAmountDue=>null; amountDue=>null]}
Leftover new object: {<ObjectId:FeePaymentReceipt,
TEMP:000009AB891D0161>; new; [amountPaid=>0; fee=>{<ObjectId:Fee,
TEMP:000008AB891D0161>}; receiptNumber=>null; datePaid=>null]}
Leftover new object: {<ObjectId:Work, TEMP:000007AB83030161>; new;
[workType=>{<ObjectId:WorkType, ID=1042>};
statusableWorkList=>{<ObjectId:StatusableWork,
TEMP:000006AB83030161>}; workOptionList=>?; objType=>ENG;
userHoursList=>?]}
Leftover new object: {<ObjectId:Fee, TEMP:00000AAB891D0161>; new;
[feePaymentReceiptList=>?; womsWorkList=>(..);
requiredDepositAmountDue=>0; amountDue=>null]}
Leftover new object: {<ObjectId:StatusableWork,
TEMP:000006AB83030161>; new; [expectedCompletionDate=>null;
work=>{<ObjectId:Work, TEMP:000007AB83030161>};
requestedCompDate=>null; workAssigneeList=>?;
problemDescription=>null; rankList=>?; attachmentList=>?;
solutionDescription=>null; externalSystemKey=>0;
statusHistoryList=>?]}
Leftover modified object: {<ObjectId:WorkType, ID=1042>; modified;
[isAssignable=>Y; parentWorkType=>{<ObjectId:WorkType, ID=1000>};
workOptionTypeList=>?; childrenWorkTypeList=>?; description=>null;
isActive=>Y; statusList=>?; objType=>null; workList=>(..); name=>T&D
Work Order]}
--- will run 2 queries.
--- transaction started.
SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = 'FEE_PAYMENT_RECEIPT'
=== returned 1 row. - took 0 ms.
UPDATE AUTO_PK_SUPPORT SET NEXT_ID = NEXT_ID + 20 WHERE TABLE_NAME =
'FEE_PAYMENT_RECEIPT'
=== updated 1 row.
org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2-dev April 10
2006] Some parts of FK are missing in snapshot, join:
org.objectstyle.cayenne.map.DbJoin@1786a3c[source=WOMS_WORK_ID,target=ID]
	at org.objectstyle.cayenne.access.DataNodePKGenerationAction.appendPkFromMasterRelationships(DataNodePKGenerationAction.java:250)
	at org.objectstyle.cayenne.access.DataNodePKGenerationAction.createPermIdsForObjEntity(DataNodePKGenerationAction.java:143)
	at org.objectstyle.cayenne.access.DataNodeInsertBucket.createPrimaryKey(DataNodeInsertBucket.java:97)
	at org.objectstyle.cayenne.access.DataNodeFlushAction.createPK(DataNodeFlushAction.java:106)
	at org.objectstyle.cayenne.access.DataDomainFlushAction.preprocess(DataDomainFlushAction.java:217)
	at org.objectstyle.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:148)
	at org.objectstyle.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:778)
	at org.objectstyle.cayenne.access.DataDomain$2.transform(DataDomain.java:749)
	at org.objectstyle.cayenne.access.DataDomain.runInTransaction(DataDomain.java:804)
	at org.objectstyle.cayenne.access.DataDomain.onSync(DataDomain.java:746)
	at org.objectstyle.cayenne.access.DataContext.flushToParent(DataContext.java:1217)
	at org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1121)



On 4/10/06, Mike Kienenberger <mk...@gmail.com> wrote:
> What would cause the following exception (latest cvs checkout)?
>
> It doesn't seem to happen deterministically.   I'm converting data
> records from one format to another, reading a set of records in, and
> then creating new set of records to write out.
>
> The first record always seems to work.   Then I always get this error
> soon afterward.  Sometimes on the second set of records, sometimes a
> few later.   On this particular run, I got it 5 record sets into the
> conversion.
>
> I dumped all of the uncommitted objects in the datacontext before
> doing the saveChanges, and that's what the "Leftover object" messages
> are showing.
>
> I've edited the attributes, hopefully leaving only the relevent ones.
>
> To the best of my knowledge, the Join in question is the relationship
> from <ObjectId:WomsWork, TEMP:00004C96C5030161> to
> <ObjectId:StatusableWork, TEMP:00004D96C5030161>, both of which exist
> and are in state new.
>
> This relationship is in my DataMap as
>
>         <db-relationship name="statusableWork" source="WOMS_WORK"
> target="STATUSABLE_WORK" toMany="false">
>                 <db-attribute-pair source="WOMS_WORK_ID" target="ID"/>
>         </db-relationship>
>
> The reverse relationship is in another DataMap as
>
>         <db-relationship name="womsWork" source="STATUSABLE_WORK"
> target="WOMS_WORK" toDependentPK="true" toMany="true">
>                 <db-attribute-pair source="ID" target="WOMS_WORK_ID"/>
>         </db-relationship>
>
> And the id for WOMS_WORK is dependent on the ID for STATUSABLE work
> (which is in turn dependent upon the ID for WORK -- vertical
> inheritance)
>
> [I changed toMany from true to false in the second db-relationship as
> that was an error I just noticed, but it hasn't made any difference].
>
> Leftover new object: {<ObjectId:Contact, TEMP:00005496CDEC0161>; new;
> Leftover new object: {<ObjectId:StatusableWork,
> TEMP:00005D96CEF60161>; new; [parentWork=>{<ObjectId:Work,
> TEMP:00004E96C5030161>}; work=>{<ObjectId:Work,
> TEMP:00005E96CEF60161>}; ]}
> Leftover new object: {<ObjectId:Work, TEMP:00004E96C5030161>; new;
> [workType=>{<ObjectId:WorkType, ID=1042>};
> statusableWorkList=>{<ObjectId:StatusableWork,
> TEMP:00004D96C5030161>}; ]}
> Leftover new object: {<ObjectId:StatusableWork,
> TEMP:00004D96C5030161>; new; [work=>{<ObjectId:Work,
> TEMP:00004E96C5030161>}; ]}
> Leftover new object: {<ObjectId:Fee, TEMP:00005296CAEF0161>; new;
> Leftover new object: {<ObjectId:ContactName, TEMP:00005396CDEC0161>; new;
> Leftover new object: {<ObjectId:Work, TEMP:00005B96CEF60161>; new;
> [workType=>{<ObjectId:WorkType, ID=1056>};
> statusableWorkList=>{<ObjectId:StatusableWork,
> TEMP:00005A96CEF60161>}; ]}
> Leftover new object: {<ObjectId:StatusableWork,
> TEMP:00005A96CEF60161>; new; [parentWork=>{<ObjectId:Work,
> TEMP:00004E96C5030161>}; work=>{<ObjectId:Work,
> TEMP:00005B96CEF60161>}; ]}
> Leftover new object: {<ObjectId:FeePaymentReceipt, TEMP:00005196CAEF0161>; new;
> Leftover new object: {<ObjectId:Address, TEMP:00005596CE0C0161>; new;
> Leftover new object: {<ObjectId:Work, TEMP:00005E96CEF60161>; new;
> [statusableWorkList=>{<ObjectId:StatusableWork,
> TEMP:00005D96CEF60161>}; ]}
> Leftover new object: {<ObjectId:WomsWork, TEMP:00004C96C5030161>; new;
> [statusableWork=>{<ObjectId:StatusableWork, TEMP:00004D96C5030161>};
> ]}
> Leftover new object: {<ObjectId:StatusHistory, TEMP:00004F96C5030161>; new;
> Leftover new object: {<ObjectId:StatusableWork,
> TEMP:00005896CE1B0161>; new; [parentWork=>{<ObjectId:Work,
> TEMP:00004E96C5030161>}; work=>{<ObjectId:Work,
> TEMP:00005996CE1B0161>}; ]}
> Leftover new object: {<ObjectId:Phone, TEMP:00005796CE1B0161>; new;
> Leftover new object: {<ObjectId:WorkAssignee, TEMP:00005C96CEF60161>;
> new; [statusableWork=>{<ObjectId:StatusableWork,
> TEMP:00005A96CEF60161>}; seq=>1; role=>{<ObjectId:SecRole,
> ID=20527>}]}
> Leftover new object: {<ObjectId:Fee, TEMP:00005096CAEF0161>; new;
> Leftover new object: {<ObjectId:WorkAssignee, TEMP:00005F96CEF60161>;
> new; [statusableWork=>{<ObjectId:StatusableWork,
> TEMP:00005D96CEF60161>}; seq=>1; role=>{<ObjectId:SecRole,
> ID=21466>}]}
> Leftover new object: {<ObjectId:Work, TEMP:00005996CE1B0161>; new;
> [statusableWorkList=>{<ObjectId:StatusableWork,
> TEMP:00005896CE1B0161>}; ]}
> Leftover new object: {<ObjectId:Address, TEMP:00005696CE1B0161>; new;
> Leftover modified object: {<ObjectId:WorkType, ID=1042>; modified;
> Leftover modified object: {<ObjectId:StateProvince,
> STATE_PROVINCE_ID=1>; modified;
> Leftover modified object: {<ObjectId:WorkType, ID=1053>; modified;
> Leftover modified object: {<ObjectId:WorkType, ID=1057>; modified;
> Leftover modified object: {<ObjectId:Status, ID=112>; modified;
> Leftover modified object: {<ObjectId:WorkType, ID=1056>; modified;
>
> org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2-dev April 10
> 2006] Some parts of FK are missing in snapshot, join:
> org.objectstyle.cayenne.map.DbJoin@ec898a[source=WOMS_WORK_ID,target=ID]
>         at org.objectstyle.cayenne.access.DataNodePKGenerationAction.appendPkFromMasterRelationships(DataNodePKGenerationAction.java:250)
>         at org.objectstyle.cayenne.access.DataNodePKGenerationAction.createPermIdsForObjEntity(DataNodePKGenerationAction.java:143)
>         at org.objectstyle.cayenne.access.DataNodeInsertBucket.createPrimaryKey(DataNodeInsertBucket.java:97)
>         at org.objectstyle.cayenne.access.DataNodeFlushAction.createPK(DataNodeFlushAction.java:106)
>         at org.objectstyle.cayenne.access.DataDomainFlushAction.preprocess(DataDomainFlushAction.java:217)
>         at org.objectstyle.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:148)
>         at org.objectstyle.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:778)
>         at org.objectstyle.cayenne.access.DataDomain$2.transform(DataDomain.java:749)
>         at org.objectstyle.cayenne.access.DataDomain.runInTransaction(DataDomain.java:804)
>         at org.objectstyle.cayenne.access.DataDomain.onSync(DataDomain.java:746)
>         at org.objectstyle.cayenne.access.DataContext.flushToParent(DataContext.java:1217)
>         at org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1121)
>