RelationshipQuery is used by Cayenne internally to fetch object(s) related to a single given object via a mapped ObjRelationship. In some cases the query can be used directly in the application, e.g. if we want to refresh related objects.
ObjectId id = new ObjectId("Artist", "ARTIST_ID", 55); RelationshipQuery query = new RelationshipQuery(id, "paintingArray", true); List paintings = context.performQuery(query);