Painting.class,
"INSERT INTO PAINTING (PAINTING_ID, ARTIST_ID, PAINTING_TITLE) VALUES (1, 1, 'p1')"));
context.performQuery(chain);
Painting p = DataObjectUtils.objectForPK(context, Painting.class, 1);
// resolve artist once before running non-refreshing query, to check that we do
// not refresh the object
Artist a = DataObjectUtils.objectForPK(context, Artist.class, 1);
long v = a.getSnapshotVersion();
int writeCalls = a.getPropertyWrittenDirectly();
assertEquals("a1", a.getArtistName());
context.performQuery(new SQLTemplate(
Artist.class,
"UPDATE ARTIST SET ARTIST_NAME = 'a2' WHERE ARTIST_ID = 1"));
RelationshipQuery toOne = new RelationshipQuery(
p.getObjectId(),
Painting.TO_ARTIST_PROPERTY,
false);
List<Artist> related = context.performQuery(toOne);
assertEquals(1, related.size());