[ 
https://issues.apache.org/jira/browse/CAY-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13583188#comment-13583188
 ] 

Andrus Adamchik commented on CAY-1798:
--------------------------------------

The patch looks good to me. Maybe you can speed it up a bit by using cached 
metadata for reverse relationship. I.e. this:

                private void fillReverseRelationship(Object destinationTarget, 
ObjRelationship relationship) {
                        ClassDescriptor desc = 
targetResolver.getClassDescriptor(relationship.getTargetEntityName());
                        
                Property reverseProperty = 
desc.getProperty(relationship.getReverseRelationshipName());
                        
                if (reverseProperty instanceof ToOneProperty) {
                    ToOneProperty targetReverseProperty = (ToOneProperty) 
reverseProperty;
                    targetReverseProperty.writeProperty(destinationTarget, 
null, target);
                }
                }

Can be rewritten using ArcProperty.getComplimentaryReverseArc() method that is 
faster than looking for a descriptor and calling 
"relationship.getReverseRelationshipName()".

Otherwise I think it can be applied to 3.1 and 3.2
                
> ROP: Reverse relationships of prefetched entity objects are not filled during 
> server to client objects conversion
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: CAY-1798
>                 URL: https://issues.apache.org/jira/browse/CAY-1798
>             Project: Cayenne
>          Issue Type: Bug
>          Components: ROP
>    Affects Versions: 3.1B2
>            Reporter: Dzmitry Kazimirchyk
>         Attachments: CAY-1798.patch
>
>
> When doing queries with prefetches from client, reverse relationships of 
> prefetched objects are not filled immediately after query execution causing 
> new queries to server when accessed.
> E.g.: say we execute query for all artists with prefetch Artist -> Paintings. 
> After query execution if we do artist.getPaintings().get(0).getArtist() then 
> new db query will be executed.

--
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