Re: Yes, even one more concurrency question - relationship "freshness"
Re: Yes, even one more concurrency question - relationship "freshness"
- Subject: Re: Yes, even one more concurrency question - relationship "freshness"
- From: Miguel Arroz <email@hidden>
- Date: Mon, 13 Aug 2007 22:56:51 +0100
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:
This email sent to email@hidden