clearing a toMany relationship fault in Java Client
clearing a toMany relationship fault in Java Client
- Subject: clearing a toMany relationship fault in Java Client
- From: Ricardo Legorreta <email@hidden>
- Date: Thu, 4 Sep 2008 12:21:25 -0500
So far so good I tested ERXEOControlUtilities.clearSnapshotForRelationshipNamed it works ok...
But for the server side only.
I´ve problems in a Java Client since in the server I´ve the correct toManyRelationship NSArray data (i.e., refreshed) , but in the client side I´m still having the old cache NSArray data from the relationship.
Any idea what I need to do?
Ricardo.
Date: Wed, 3 Sep 2008 11:29:27 -0700 From: Chuck Hill <email@hidden> Subject: Re: clearing a toMany relationship fault To: Lachlan Deck <email@hidden> Cc: Development WebObjects <email@hidden> Message-ID: <email@hidden">email@hidden> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
This is something that really should get done as part of a refreshing fetch. I think bugs have been filed on this, but another voice increases the priority.
Was there some other place you were thinking of having this called automatically? It might be useful to add a refresh() method to ERXGenericRecord that would refresh the snapshot and all to-many() relationships. But then... what about the related objects? How far do you go?
Chuck
On Sep 3, 2008, at 5:04 AM, Lachlan Deck wrote:
Okay, so there's
ERXEOControlUtilities.clearSnapshotForRelationshipNamed[InDatabase]
(which saves me a few lines of code :) but which doesn't appear to
be auto-called from anywhere(?). Would it be useful for there to be
a property that does something like this automatically?
What I've now got in my ERXGenericRecord subclass now is:
public void awakeFromFetch( EOEditingContext editingContext )
{
super.awakeFromFetch( editingContext );
if ( editingContext ==
EOSharedEditingContext.defaultSharedEditingContext()
&&
ISHApplication
.ishApplication
().hasFetchedInitialSharedRecordsForEntity( entityName() ) )
{
for ( Enumeration< ? > en =
classDescription().toOneRelationshipKeys().objectEnumerator();
en.hasMoreElements(); )
{
String key = en.nextElement().toString();
EORelationship inverseRelationship =
entity().relationshipNamed( key ).inverseRelationship();
if ( inverseRelationship != null &&
inverseRelationship.isToMany() )
{
EOEnterpriseObject eo = ( EOEnterpriseObject )valueForKey( key );
if ( eo != null )
// this next line covers Anjo's code from the wiki page below
ERXEOControlUtilities.clearSnapshotForRelationshipNamed( eo,
inverseRelationship.name() );
}
}
}
}
This is working fine. Is there any suggestions on anything else that
might need doing for completeness?
On 03/09/2008, at 5:07 PM, Lachlan Deck wrote:
Hi Simon,
On 03/09/2008, at 4:37 PM, Simon McLean wrote:
this might help:
http://en.wikibooks.org/wiki/Programming:WebObjects/EOF/Using_EOF/Caching_and_Freshness#Refreshing_Many-to-Many_Relationships
Yes - that's exactly the sort of stuff I'm trying to solve.
Question: is there some property in Wonder that does this
automatically?
On 3 Sep 2008, at 07:34, Lachlan Deck wrote:
Hi there,
just wondering ... how would I go about clearing the faults for
certain toMany relationships of an object. i.e., I'm iterating
through certain toMany keys and I want to obtain the faults
without firing them (best case scenario) and then clear them so
that they are refreshed.
Any suggestions?
with regards,
--
Lachlan Deck |
_______________________________________________
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