RE: does EOEditingContext.refreshObject work?
RE: does EOEditingContext.refreshObject work?
- Subject: RE: does EOEditingContext.refreshObject work?
- From: Chuck Hill <email@hidden>
- Date: Sat, 20 Dec 2003 19:01:19 -0800
Hi Adam,
At 09:04 PM 20/12/2003 -0500, Adam Ramadan wrote:
>Ok, I added a System.out of the committedSnapshotForObject:
>
>...
> System.out.println(ec.committedSnapshotForObject(e));
> ec.refreshObject(e);
> System.out.println(ec.committedSnapshotForObject(e));
>...
>
>The relevent field is "text", and you're correct, it has changed in the
>committed snapshot.
>
>Before: text = <com.webobjects.foundation.NSKeyValueCoding$Null>;
>After: text = "whatever";
>
Meaning that you have changed text to "whatever" in the editing context and
not saved it and that text is null in the database?
If you are not using session().defaultEditingContext(), are you locking the
editing contexts that you use? If not this is a potential cause of your
problem.
If that is not the problem, then report this at bugreport.apple.com. It is
very, very helpful to provide a minimal reproduction case if you report a bug.
>If this is a bug, is anyone familiar with it,
This is a new method and was only documented with the 5.2.2 release so it
may be that nobody else is using it.
>or could someone suggest possible workarounds to try?
>
What is it that you are trying to achieve?
Chuck
>
>-----Original Message-----
>From: email@hidden
>[mailto:email@hidden]On Behalf Of Chuck Hill
>Sent: December 20, 2003 20:29
>To: Adam Ramadan; WOdev List List
>Subject: Re: does EOEditingContext.refreshObject work?
>
>
>What does ec.committedSnapshotForObject(updatedObject) show? Does it
>contain your unsaved changes? It sounds as if doing the refresh has
>resulting in the committed snapshot containing the updated attributes.
>This, obviously, would be a bug.
>
>Chuck
>
>
>At 06:43 PM 20/12/2003 -0500, Adam Ramadan wrote:
>>Hi,
>>
>>I have an enterprise object which has been modified and before saving the
>>changes I want to refresh the object in order to check one of its fields.
>>After calling refreshObject(...) I see any changes to the field I'm
>>interested in, and the changes that had been made to the enterprise object
>>are still there, as expected from reading the JavaDoc. Unfortunately, the
>>EOEditingContext.hasChanges() now returns false (it returns true prior to
>>the refreshObject() call, and the object being refreshed is the only
>>modified object in the context). Even if I modify the object again the
>>EOEditingContext seems completely unaware, and the saveChanges method()
>does
>>nothing.
>>
>>I haven't done anything fancy with my enterprise objects, they are what was
>>generated from the EOModeler, and no methods have overridden or anything
>>like that.
>>
>>Am I misunderstanding something? Is this a bug in WebObjects (I'm using
>>version 5.2.2, Java 1.4.1_05, on Windows 2000)?
>>
>>Thanks very much for any help,
>>Adam
>>_______________________________________________
>>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.
>>
>
>--
>
>Chuck Hill email@hidden
>Global Village Consulting Inc. http://www.global-village.net
>_______________________________________________
>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.
>_______________________________________________
>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.
>
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
_______________________________________________
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.