createArtistWithPaintingsInGalleryDataSet();
Artist a1 = Cayenne.objectForPK(context, Artist.class, 8);
Gallery g1 = Cayenne.objectForPK(context, Gallery.class, 11);
Expression e = ExpressionFactory.matchExp("paintingArray.toGallery", g1);
SelectQuery q = new SelectQuery("Artist", e);
List<Artist> artists = context.performQuery(q);
assertEquals(1, artists.size());
assertSame(a1, artists.get(0));