Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Yes, even one more concurrency question - relationship "freshness"



Hi!

On 2007/08/13, at 21:44, Chuck Hill wrote:

Then something in your app is refreshing the to-many relationship.

Well, the problem is much more strange than I thought (we are entering the "you surely know how to have fun with WO" zone!).


  I have the a.bs() to-many relationship.

  I have a cycle where I do the following (pseudo-java-code):

  while( optimistic locking failures exists ) {
    NSMutableArray array = new NSMutableArray();

    B newB = makeNewB();
    array.addObject(newB);
    a.addObjectToBothSidesOfRelationship( b, "bs" );

a.editingContext().processRecentChanges(); // Just in case, but doesn't appear to help

    PrintALotOFStuffHere;

    try {
      saveChanges();
    } catch OL exception {
      for all objects obj in array {
        obj.removeObjectFromBothSidesOfRelationship( a, "a" );
        obj.editingContext().deleteObject(obj);
      }
      array.removeAllObjects();
      // Do some refaults
    }
  }

  In "print a lot of stuff", I do print, between other stuff:

  - The Bs in the a.bs() relationship.
  - The EC deleted, inserted and updated objects.

  Well, when there's no OL failure, this works.

  When there's a OL failure, on the second try, I get the following:

The "newB" object created on the first cicle run is NOT on the bs () relationship, neither in inserted, deleted or updated objects of the EC. It makes sense: I created and destroyed it before being able to put it on the data storage.

But... it's precisely that object that causes my error. When I try to saveChanges in the second run, I get an exception saying the object is not registered on any EC. Also, all it's relationships are "null", so I did not forget to remove it from any relationship.

So... if my object belongs to no EC, and if it's not related to any other object... why the heck is it causing problems? It shoudn't even exist at that point. How can I ask WO why is it caring about that object when saving?

  Yours

Miguel Arroz


Miguel Arroz http://www.terminalapp.net http://www.ipragma.com



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/email@hidden

This email sent to email@hidden
References: 
 >Yes, even one more concurrency question - relationship "freshness" (From: Miguel Arroz <email@hidden>)
 >Re: Yes, even one more concurrency question - relationship "freshness" (From: Chuck Hill <email@hidden>)
 >Re: Yes, even one more concurrency question - relationship "freshness" (From: Miguel Arroz <email@hidden>)
 >Re: Yes, even one more concurrency question - relationship "freshness" (From: Chuck Hill <email@hidden>)
 >Re: Yes, even one more concurrency question - relationship "freshness" (From: Miguel Arroz <email@hidden>)
 >Re: Yes, even one more concurrency question - relationship "freshness" (From: Chuck Hill <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.