On Aug 28, 2006, at 10:41 AM, Fabrice Pipart wrote:

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.

In thread 1? In the database? I would expect it to be 1 in Thread one as it is still locked and that prevents external changes from affecting it. It should not be 1 in the database.


I found why. Just because I set the A.B relationship in thread1, B is part of the thread1 ec's "unprocessedChanges"

The relationship should be, but not B's values as you have not changed them.

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?


Sounds odd if it is getting into the database.

Chuck

--

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      (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