Re: clearing a toMany relationship fault
Re: clearing a toMany relationship fault
- Subject: Re: clearing a toMany relationship fault
- From: Lachlan Deck <email@hidden>
- Date: Wed, 3 Sep 2008 22:04:03 +1000
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