I know for sure that they all share the same DataContext as this is
happening in a very small and simple unit test. The create method
calls are taking place one right after the other. And the ctx is
actually a static memeber that only gets initialized once for each
run.
I'll see how it behaves it my actual setting (going to be used in a
webapp) and see what happens with how things are getting setup there.
Will report anything I find!
-Nick
On 8/22/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
> 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 : Tue Aug 23 2005 - 15:36:55 EDT