Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.1B2
-
None
Description
If same records getting prefetched through multiple prefetch paths, the final result will content corrupted records with relationships set to null. Example:
Paintings are present in one prefetch path:
SelectQuery q = new SelectQuery(Artist.class);
q.addPrefetch(Artist.PAINTING_ARRAY_PROPERTY);
q.addPrefetch(Artist.PAINTING_ARRAY_PROPERTY + "." + Painting.TO_PAINTING_INFO_PROPERTY);
artist.getPaintingArray().get(0).getPaintingInfo() will contain correct non null PaintingInfo record.
But if paintings are present in multiple prefetch paths:
SelectQuery q = new SelectQuery(Artist.class);
q.addPrefetch(Artist.PAINTING_ARRAY_PROPERTY);
q.addPrefetch(Artist.PAINTING_ARRAY_PROPERTY + "." + Painting.TO_PAINTING_INFO_PROPERTY);
q.addPrefetch(Artist.ARTIST_EXHIBIT_ARRAY_PROPERTY);
q.addPrefetch(Artist.ARTIST_EXHIBIT_ARRAY_PROPERTY + "." + ArtistExhibit.TO_EXHIBIT_PROPERTY);
q.addPrefetch(Artist.ARTIST_EXHIBIT_ARRAY_PROPERTY + "." + ArtistExhibit.TO_EXHIBIT_PROPERTY + "." + Exhibit.TO_GALLERY_PROPERTY);
q.addPrefetch(Artist.ARTIST_EXHIBIT_ARRAY_PROPERTY + "." + ArtistExhibit.TO_EXHIBIT_PROPERTY + "." + Exhibit.TO_GALLERY_PROPERTY + "." + Gallery.PAINTING_ARRAY_PROPERTY);
artist.getPaintingArray().get(0).getPaintingInfo() will return null even if there is PaintingInfo associated with painting.