Re: Weird behavior (M5)

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Aug 22 2005 - 17:01:42 EDT

  • Next message: Neil Pierson: "Object Graph question"

    Hi Nick,

    This definitely moves us closer to the cause. My guess is that
    ToManyList.mergeLocalChanges(..) combines blocks just fetched in
    "resolvedObjectList" with the ones that were added earlier, ignoring
    the fact that those are the same objects... The only reason why this
    can happen is that you have more than one DataContext in the picture.

    A few things to check:

    * check that all 4 objects in the list have the same DataContext.
    * If not, try to find where you create a second DataContext and make
    sure you don't mix objects from different contexts.

    Please share your findings - maybe we can better detect cross-context
    issues at the framework level.

    Andrus

    On Aug 22, 2005, at 4:26 PM, Nick Stuart wrote:

    > Hi Andrus, took some time and stepped through the code and found out
    > exactly what is going on, still dont know why, but here is what is
    > happening.
    >
    > In my page create method I pass a template object in. The template has
    > a toManyList for blocks. When the method starts this toManyList has
    > the list "addedToUnresolved" and it has the right number (2) of
    > objects in it. The wierd part is, as soon as I run this line:
    > List tBlocks = template.getBlocks();
    > the objects move from "addedToUnresolved" to "objectList" but now I
    > have 4 of them. :(
    >
    > It gets stranger, in that if I run this line:
    > assertEquals(2, template.getBlocks().size());
    > Then the objects go from "addedToUnresolved" to "objectList" and I end
    > up with the right amount of objects.
    >
    > Hope this helps you out, and explains my situation a little better. If
    > you need any more info let me know.
    >
    > -Nick
    >



    This archive was generated by hypermail 2.0.0 : Mon Aug 22 2005 - 17:01:46 EDT