Hi list !

I recently solved a bug I had but I still wonder why it happened.
Could someone help me understand the following?

Lets say I have a relationship between A and B : A <<--> B
In EOModeler both have diamonds (accessible via code)

I have two threads
In thread1 (locked of course)
I fetch B1
In thread2 (locked of course)
I modify B1 : B1.value changed from 1 to 2
I saveChanges() : B1.value is 2
In thread1
I create A1 and call A1.addObjectToBothSidesOfRelationshipWithKey(B1, "B");
I saveChanges

At that moment I have my B that has a value back to 1.
I found why. Just because I set the A.B relationship in thread1, B is part of the thread1 ec's "unprocessedChanges"
And therefore, its the old value of B that is saved in thread1

If I remove the diamond in Bs relationship it works fine

Is this a normal behavior?
Do I do something wrong?


Fabrice

www.easyshadow.com


International Corporate Consulting

Palais de la Scala

1 avenue Henri Dunant

Suite 1155

MC - 98000 Monaco


Skype: fabrice.pipart

Tel.  +377 97 98 21 04 (direct)

Fax. +377 97 70 88 07



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

This email sent to archive@mail-archive.com

Reply via email to