assertEquals(key1v1, object.getObjectId().getIdSnapshot().get(
CompoundPkTestEntity.KEY1_PK_COLUMN));
assertEquals(key2v1, object.getObjectId().getIdSnapshot().get(
CompoundPkTestEntity.KEY2_PK_COLUMN));
ObjectIdQuery refetch = new ObjectIdQuery(
object.getObjectId(),
false,
ObjectIdQuery.CACHE_REFRESH);
refreshedObject = (CompoundPkTestEntity) Cayenne.objectForQuery(
context,
refetch);
assertEquals(object.getObjectId(), refreshedObject.getObjectId());
object.setKey2(key2v2);
context.commitChanges();
assertEquals(key1v1, object.getObjectId().getIdSnapshot().get(
CompoundPkTestEntity.KEY1_PK_COLUMN));
assertEquals(key2v2, object.getObjectId().getIdSnapshot().get(
CompoundPkTestEntity.KEY2_PK_COLUMN));
ObjectIdQuery refetch1 = new ObjectIdQuery(
object.getObjectId(),
false,
ObjectIdQuery.CACHE_REFRESH);
refreshedObject = (CompoundPkTestEntity) Cayenne.objectForQuery(
context,
refetch1);
assertEquals(object.getObjectId(), refreshedObject.getObjectId());
object.setKey2(key2v3);
context.commitChanges();
assertEquals(key1v1, object.getObjectId().getIdSnapshot().get(
CompoundPkTestEntity.KEY1_PK_COLUMN));
assertEquals(key2v3, object.getObjectId().getIdSnapshot().get(
CompoundPkTestEntity.KEY2_PK_COLUMN));
ObjectIdQuery refetch2 = new ObjectIdQuery(
object.getObjectId(),
false,
ObjectIdQuery.CACHE_REFRESH);
refreshedObject = (CompoundPkTestEntity) Cayenne.objectForQuery(
context,