BoxInfo bi2 = context.newObject(BoxInfo.class);
invalidate.add(bi2);
bi2.setColor("green");
bi2.setBox(bx2);
Thing t1 = context.newObject(Thing.class);
invalidate.add(t1);
t1.setVolume(10);
t1.setWeight(10);
Ball bl1 = context.newObject(Ball.class);
invalidate.add(bl1);
bl1.setBox(bx1);
bl1.setThingVolume(10);
bl1.setThingWeight(10);
Thing t2 = context.newObject(Thing.class);
invalidate.add(t2);
t2.setVolume(20);
t2.setWeight(20);
Ball bl2 = context.newObject(Ball.class);
invalidate.add(bl2);
bl2.setBox(bx1);
bl2.setThingVolume(20);
bl2.setThingWeight(20);
Thing t3 = context.newObject(Thing.class);
invalidate.add(t3);
t3.setVolume(30);
t3.setWeight(30);
Ball bl3 = context.newObject(Ball.class);
invalidate.add(bl3);
bl3.setBox(bx2);
bl3.setThingVolume(30);
bl3.setThingWeight(30);
Thing t4 = context.newObject(Thing.class);
invalidate.add(t4);
t4.setVolume(40);
t4.setWeight(40);
Ball bl4 = context.newObject(Ball.class);
invalidate.add(bl4);
bl4.setBox(bx2);
bl4.setThingVolume(40);
bl4.setThingWeight(40);
Thing t5 = context.newObject(Thing.class);
invalidate.add(t5);
t5.setVolume(20);
t5.setWeight(10);
Ball bl5 = context.newObject(Ball.class);
invalidate.add(bl5);
bl5.setBox(bx2);
bl5.setThingVolume(20);
bl5.setThingWeight(10);
Thing t6 = context.newObject(Thing.class);
invalidate.add(t6);
t6.setVolume(40);
t6.setWeight(30);
Ball bl6 = context.newObject(Ball.class);
invalidate.add(bl6);
bl6.setBox(bx2);
bl6.setThingVolume(40);
bl6.setThingWeight(30);
context.commitChanges();
tBoxThing.insert(Cayenne.intPKForObject(bx1), t1.getWeight(), t1.getVolume());
tBoxThing.insert(Cayenne.intPKForObject(bx1), t2.getWeight(), t2.getVolume());
tBoxThing.insert(Cayenne.intPKForObject(bx2), t3.getWeight(), t3.getVolume());
tBoxThing.insert(Cayenne.intPKForObject(bx1), t4.getWeight(), t4.getVolume());
tBoxThing.insert(Cayenne.intPKForObject(bx1), t5.getWeight(), t5.getVolume());
tBoxThing.insert(Cayenne.intPKForObject(bx1), t6.getWeight(), t6.getVolume());
context.invalidateObjects(invalidate);
}