Hi,

I'm having some troubles understanding commitChanges() and
commitChangesToParent() :-/

I've created a test case with two ObjectContexts
ObjectContext context1 = runtime.newContext();
ObjectContext context2 = runtime.newContext();

then I load the same entity in both contexts
PpAfkoPordershead order1 = PpAfkoPordershead.getByAufnr(context1, 123);
PpAfkoPordershead order2 = PpAfkoPordershead.getByAufnr(context2, 123);

then I tried this
Integer quantity = order1.getQuantity();
order1.setQuantity(quantity + 1);
context1.commitChanges();
Assert.assertEquals(quantity, order2.getQuantity());

this works as the second context get synched by the commit.

but why does this work too?
Integer quantity = order1.getQuantity();
order1.setQuantity(quantity + 1);
context1.commitChangesToParent();
Assert.assertEquals(quantity, order2.getQuantity());

regards
Meex

Reply via email to