You have to assign the result of localObject.

John
On Sep 5, 2013 12:59 AM, "Markus Reich" <markus.re...@markusreich.at> wrote:

> Hi,
>
> I've a question concering child contexts, when I add an object to a child
> context with method localObject, I thought the object is really from parent
> to child context?
>
> But when I run the following JUnit Test, it doesn't fail, although it
> should?
>
>   @Test
>   public void testChildContext() {
>     // create test instance
>     MiiPickingcontainer container =
> MiiPickingcontainer.createInstance(context, "9999", "9999", "JUNIT");
>     context.commitChanges();
>
>     Assert.assertEquals(0, context.modifiedObjects().size());
>     ObjectContext childContext = runtime.newContext(context.getChannel());
>     // move object to child context
>     childContext.localObject(container);
>     container.setStatusid(330);
>     Assert.assertEquals(1, context.modifiedObjects().size());
>     Assert.assertEquals(0, childContext.modifiedObjects().size());
>     // commit childcontext
>     childContext.commitChangesToParent();
>     Assert.assertEquals(1, context.modifiedObjects().size());
>     Assert.assertEquals(0, childContext.modifiedObjects().size());
>
>     // clean up
>     context.deleteObjects(container);
>     context.commitChanges();
>   }
>
> I'm using Cayenne 3.2M1
>
> kind regards
>
> Meex
>

Reply via email to