On Sep 9, 2008, at 11:37 PM, Lachlan Deck wrote:

On 04/09/2008, at 4:29 AM, Chuck Hill wrote:

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.

radar://6209169

Was there some other place you were thinking of having this called automatically?

Not sure if this should be for every ec or not. The only problem I came across was new objects added to the db via another app didn't find their way into the reverse toMany relationships until they weren't cleared.

With a regular fetch or a refreshing fetch or faulting?


It might be useful to add a refresh() method to ERXGenericRecord that would refresh the snapshot and all to-many() relationships.

All toManys or just the reverse toManys like I've done?

The problem goes both ways.

But then... what about the related objects?  How far do you go?

What about them? Only those with toMany relationships to the object changed/inserted are affected afaik.

I think you are looking at something to be done when they are fetched: finding all the potentially affected objects and re-faulting their to- many. I was looking at it from the opposite side: refreshing objects in memory and having that also refresh some of the to-many relationships in the object graph.

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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net

This email sent to [EMAIL PROTECTED]


--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects

with regards,
--

Lachlan Deck





--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to