EO Changes Not Saving to DB?
EO Changes Not Saving to DB?
- Subject: EO Changes Not Saving to DB?
- From: Kieran Kelleher <email@hidden>
- Date: Mon, 24 May 2004 10:13:57 -0400
I want to handle an optimistic lock exception by refreshing the EO from
the database and reapplying the new field values that the user had
entered just before they had attempted to save (essentially merging the
updated values with the latest db values into the current editing
context and saving that merged version). The sequence of events is
working well except that the last step using the ec's saveChanges
method is not firing the fault and generating the SQL output. Here is
what I am doing..........
The chain of events begins when the user submits a form and an
optimistic locking exception is thrown since the db values have been
changed by a different instance of the application.
// after catching and determining I have an optimistic locking
exception, I successfully retrieve the updated attributes from the
failed EO
NSDictionary valuesInFailedSave = adaptorOperation.changedValues();
// later, I refault the EO
defaultEditingContext().refaultObject(failedEO);
// next I reapply the updated values to the failedEO. I think this is
where the problem is because watching the EOAdaptor Debug log, this
statement does not immediately retrieve the db values and apply the
dictionary values?? Should it not?
failedEO.reapplyChangesFromDictionary(valuesInFailedSave);
// finally I call
defaultEditingContext().saveChanges();
// ........... and nothing happens!
Next the app displays the EO in a new page (save confirmation) and then
EOF fires the fault, selects the latest values and applies the changes
and the desired "merged" EO is correctly displayed!! The only problem
is it never got saved. It seems the fault does not get fired as a
result of the reapplyChangesFromDictionary and the saveChanges methods
Any ideas?
-Kieran
___________________________________
Kieran Kelleher
SmartleadsUSA,LLC
2656 West Lake Rd
Palm Harbor, FL 34684
email@hidden
727-785-0766 x33
_______________________________________________
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.