SelectQuery q = new SelectQuery(Artist.class);
q.addOrdering("db:ARTIST_ID", SortOrder.ASCENDING);
List artists = context.performQuery(q);
Artist a1 = (Artist) artists.get(0);
Artist a2 = (Artist) artists.get(1);
Painting p1 = a1.getPaintingArray().get(0);
Painting p2 = a1.getPaintingArray().get(0);
assertNotNull(context
.getParentDataDomain()
.getSharedSnapshotCache()
.getCachedSnapshot(a1.getObjectId()));
assertNotNull(context
.getParentDataDomain()
.getSharedSnapshotCache()
.getCachedSnapshot(a2.getObjectId()));
assertNotNull(context
.getParentDataDomain()
.getSharedSnapshotCache()
.getCachedSnapshot(p1.getObjectId()));
assertNotNull(context
.getParentDataDomain()
.getSharedSnapshotCache()
.getCachedSnapshot(p2.getObjectId()));
RefreshQuery refresh = new RefreshQuery();
context.performQuery(refresh);
assertNull(context
.getParentDataDomain()
.getSharedSnapshotCache()
.getCachedSnapshot(a1.getObjectId()));
assertNull(context
.getParentDataDomain()
.getSharedSnapshotCache()
.getCachedSnapshot(a2.getObjectId()));
assertNull(context
.getParentDataDomain()
.getSharedSnapshotCache()
.getCachedSnapshot(p1.getObjectId()));
assertNull(context
.getParentDataDomain()
.getSharedSnapshotCache()
.getCachedSnapshot(p2.getObjectId()));
assertEquals(PersistenceState.HOLLOW, a1.getPersistenceState());
assertEquals(PersistenceState.HOLLOW, a2.getPersistenceState());
assertEquals(PersistenceState.HOLLOW, p1.getPersistenceState());
assertEquals(PersistenceState.HOLLOW, p2.getPersistenceState());
}