Re: Force Refresh Relation
Re: Force Refresh Relation
- Subject: Re: Force Refresh Relation
- From: Pierre Bernard <email@hidden>
- Date: Tue, 18 Sep 2007 22:48:31 +0200
It should, but under WO 5.2 it doesn't. I haven't tested in later
versions.
There is a way to fix this by subclassing EODatabaseContext:
/**
* Internal method that handles prefetching of to-many
relationships.<BR>
* // TBD This is a workaround to what looks like a bug in WO 5.1 &
WO 5.2.
* Remove as soon as it's no longer needed
*
* The problem is that even refreshing fetches don't refresh the to-
many
* relationships they prefetch.
*/
public void _followToManyRelationshipWithFetchSpecification
(EORelationship relationship,
EOFetchSpecification fetchspecification, NSArray objects,
EOEditingContext editingcontext)
{
int count = objects.count();
for (int i = 0; i < count; i++) {
EOEnterpriseObject object = (EOEnterpriseObject)
objects.objectAtIndex(i);
EOGlobalID sourceGlobalID = editingcontext.globalIDForObject(object);
String relationshipName = relationship.name();
if (!object.isFault()) {
EOFaulting toManyArray = (EOFaulting) object.storedValueForKey
(relationshipName);
if (!toManyArray.isFault()) {
EOFaulting tmpToManyArray = (EOFaulting)
arrayFaultWithSourceGlobalID(
sourceGlobalID, relationshipName, editingcontext);
// Turn the existing array back into a fault by assigning it
// the fault handler of the newly created fault
toManyArray.turnIntoFault(tmpToManyArray.faultHandler());
}
}
}
super._followToManyRelationshipWithFetchSpecification(relationship,
fetchspecification,
objects, editingcontext);
}
Pierre
On Sep 18, 2007, at 7:17 PM, Anthony Paras wrote:
On 9/18/07 11:05 AM, "Daniele Corti" <email@hidden> wrote:
I also used an EOFetchSpecification with
setRefreshesRefetchedObjects(true),
so I don't know why the objects are not displayed!
is there another way to force the refetch of a relationship?
What if you prefetch the relationship? I believe that if you set
setRefreshesRefetchedObjects(true) and prefetch the relationship,
it should
work.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
- - -
Houdah Software s. à r. l.
http://www.houdah.com
HoudahGeo: One-stop photo geocoding
HoudahSpot: Powerful Spotlight frontend
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden