Re: snapshot
Re: snapshot
- Subject: Re: snapshot
- From: "Jonathan Fleming" <email@hidden>
- Date: Tue, 11 Feb 2003 23:21:33 +0000
From: Art Isbell <email@hidden>
To: email@hidden
Subject: Re: snapshot
Date: Mon, 10 Feb 2003 17:19:53 -1000
On Monday, February 10, 2003, at 06:50 AM, Jonathan Fleming wrote:
Any ideas why I may have got this error:
Error: java.lang.IllegalStateException
Reason: Encountered a newly inserted EO with an owns desstination
relationship but no snapshot.
A clue is that problem involved a relationship with the "Owns Destination"
property set. These aren't common in many eomodels, so this should help
narrow down the possibilities. An "Owns Destination" property means that
the destination object can't exist without being in a relationship. So if
such an object is removed from a relationship but not placed in another
relationship by the time its editing context is sent a saveChanges()
message, the destination object will be deleted from the DB automatically.
It's not clear to me from the error message whether the source or
destination object has no snapshot. But a newly-inserted object won't have
a snapshot until it has been saved to the DB, so I'm guessing that the
destination object has no snapshot.
Yes, you were absolutly right Art. I figured it out through the small hours,
last night. I was trying to set a oneTOne relationship in the ec but i
didn't need to. I still don't fully understand that, but that's what was
mainly causing all my problems on the "can not save to
defaultEditingContext" post. there were some validation issues that were
untidy too but i found those when I took that part of the app back to a
protatype of sorts.
this was the relationship:
tbClient-(owns tbClientData, propagates primary key) > <
(mandatory)-tbClientData
I was trying to do the code below before I got rid of the TbClientData code
completly to find my solution:
EOEditingContext ec = session().defaultEditingContext();
TbClient newTbClient = new TbClient();
ec.insertObject(newTbClient);
session.getUser().addObjectToBothSidesOfRelationshipWithKey(newTbClient,
"tbClients");
tbClient = newTbClient;
TbClientData newTbClientData = new TbClientData();
ec.insertObject(newTbClientData);
tbClientData.addObjectToBothSidesOfRelationshipWithKey(newTbClientData,
"tbClient");
tbClientData = newTbClientData;
ec.saveChanges();
I'd love a bit more explanation to understand why that was for future ref,
however, in the meantime I'll leave you with this and your post may be in
time to save me some severe head shaking while i'm getting on with trying to
add a tbClientData object probebly through something like
takeValueForKeyPath to get the tbClientData populated in the database.
Thanks all.
Jonathan
Because you know what operations occurred prior to this exception, you
should be able to make some educated guesses about why it occurred and test
these guesses by changing the operations.
Art
http://homepage.mac.com/aisbell/
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8.
http://join.msn.com/?page=features/junkmail
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.