Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-1802

Records present in multiple prefetch paths are not merged correctly into final result

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1B2
    • 4.0.M2
    • Core Library
    • 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.

      Attachments

        1. CAY-1802-test.patch
          6 kB
          Dzmitry Kazimirchyk

        Activity

          People

            Unassigned Unassigned
            demitri Dzmitry Kazimirchyk
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: