Re: Pb updating a to-many relationship with refaultAllObjects()
Re: Pb updating a to-many relationship with refaultAllObjects()
- Subject: Re: Pb updating a to-many relationship with refaultAllObjects()
- From: email@hidden
- Date: Mon, 17 Nov 2003 12:22:45 CDT
- Priority: 3 (Normal)
[demime could not interpret encoding binary - treating as plain text]
In general, I think invalidating objects is to be avoided unless
absolutely neccesary. There are usually other ways to get fresh data
(see my recent message on the topic; there may also be a chapter in the
EOF book about this, I forget). And invalidating objects can mess up
optimistic locking, if you are using it, and also sometimes confuse EOF
in other ways. My current thinking on the subject is that there's
(almost) always an alternative to invalidating that will do what you
want, and that alternative should be used. Making use of the fetch
timestamp on an EC in one way or another, often combined with refaulting,
is usually part of the alternative.
--Jonathan
On Sat, 15 Nov 2003 01:45:22 -0500 Robert Walker wrote:
> Jean,
>
> If I'm not mistaken, I don't believe ec.refaultAllObjects() causes the
> row snapshots to be refreshed. This would simply refault all the
> objects in ec. Then when the faults are fired, you will fetch the same
> cached data from the snapshots, unless the snapshot time stamps are
> older than the editing context's time stamp. There are several methods
> for achieving what you want. They are discussed in the section
> "Ensuring Fresh Data" under "Fetching Data" in the "Enterprise Objects"
> document on the WebObjects Documentation site. Be sure to also follow
> the "Refreshing Cached Data" link in that section.
>
> It seems that the preferred method is using
> setRefreshesRefetchedData(true) on an EOFetchSpecification. However,
> this assumes you're using a fetch specification to fetch the objects.
> The other methods discussed involve invalidating objects or even
> manually setting the editing context's fetch time stamp. All of which
> seem to be more extreme and could have a significant performance
> impact.
>
> I hope this helps. I'm not really an expert on this issue, but I've
> been studying up on it.
>
> On Nov 14, 2003, at 5:02 PM, Jean Pierre Malrieu wrote:
>
> > Hi,
> >
> > I have a component displaying the items of a to-many relationship in a
> > repetition. Therefore I am not fetching the items. WO does it for me.
> > Because the items in the to-many can be changed by another
> > application, I have added a "Refresh" button to my component. This
> > button is bound to an action that calls ec.refaultAllObjects() and
> > returns the current page.
> >
> > But if an item has been added to the to-many relationship by another
> > application, calling refaultAllObjects() does not update the list of
> > items in my component.
> > Is it normal behaviour?
> > What is the solution?
> >
> > Thanks.
> >
> > Jean Pierre.
> > _______________________________________________
> > 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.
> >
> >
> --
> Think Different
> Robert Walker
> www.robertwalker1.com
> _______________________________________________
> 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.