}
public void testCompoundPkChangeSingleElement() throws Exception {
DataContext context = createDataContext();
CompoundPkTestEntity dao = context
.newObject(CompoundPkTestEntity.class);
CompoundPkTestEntity refreshedDao = null;
dao.setKey1(key1v1);
dao.setKey2(key2v1);
dao.setName("testing testing");
context.commitChanges();
assertEquals(key1v1, dao.getObjectId().getIdSnapshot().get(
CompoundPkTestEntity.KEY1_PK_COLUMN));
assertEquals(key2v1, dao.getObjectId().getIdSnapshot().get(
CompoundPkTestEntity.KEY2_PK_COLUMN));
refreshedDao = (CompoundPkTestEntity) context.refetchObject(dao.getObjectId());
assertEquals(dao.getObjectId(), refreshedDao.getObjectId());
dao.setKey2(key2v2);
context.commitChanges();
assertEquals(key1v1, dao.getObjectId().getIdSnapshot().get(
CompoundPkTestEntity.KEY1_PK_COLUMN));
assertEquals(key2v2, dao.getObjectId().getIdSnapshot().get(
CompoundPkTestEntity.KEY2_PK_COLUMN));
refreshedDao = (CompoundPkTestEntity) context.refetchObject(dao.getObjectId());
assertEquals(dao.getObjectId(), refreshedDao.getObjectId());
dao.setKey2(key2v3);
context.commitChanges();
assertEquals(key1v1, dao.getObjectId().getIdSnapshot().get(
CompoundPkTestEntity.KEY1_PK_COLUMN));
assertEquals(key2v3, dao.getObjectId().getIdSnapshot().get(
CompoundPkTestEntity.KEY2_PK_COLUMN));
refreshedDao = (CompoundPkTestEntity) context.refetchObject(dao.getObjectId());
assertEquals(dao.getObjectId(), refreshedDao.getObjectId());
}