[ 
https://issues.apache.org/jira/browse/CAY-1802?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dzmitry Kazimirchyk updated CAY-1802:
-------------------------------------

    Attachment: CAY-1802-test.patch

Attaching unit test demonstrating the issue.
                
> Records present in multiple prefetch paths are not merged correctly into 
> final result
> -------------------------------------------------------------------------------------
>
>                 Key: CAY-1802
>                 URL: https://issues.apache.org/jira/browse/CAY-1802
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 3.1B2
>            Reporter: Dzmitry Kazimirchyk
>         Attachments: CAY-1802-test.patch
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to