DataContext context = createDataContext();
Artist a1 = (Artist) context.newObject("Artist");
a1.setArtistName("a");
Painting1 p1 = (Painting1) context.newObject("Painting1");
p1.setPaintingTitle("p");
// *** TESTING THIS ***
p1.setToArtist(a1);
assertSame(a1, p1.getToArtist());
context.commitChanges();
ObjectId aid = a1.getObjectId();
ObjectId pid = p1.getObjectId();
context.invalidateObjects(Arrays.asList(a1, p1));
Painting1 p2 = (Painting1) DataObjectUtils.objectForPK(context, pid);
Artist a2 = p2.getToArtist();
assertNotNull(a2);
assertEquals(aid, a2.getObjectId());
}