[ 
https://issues.apache.org/jira/browse/OPENJPA-370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12539221
 ] 

Craig Russell commented on OPENJPA-370:
---------------------------------------

> Before the instance is returned to the caller, the fields are checked again 
> if they cause any other field be loaded because LoadFecthGroup. At that 
> point, if field f has a LoadFetchGroup L and L is not part of the active 
> fetch configuration then *temporarily* add L to the active FetchConfiguration 
> and go for another 'fetch' (i.e. from the datastore). 

This sounds wrong. The effect of the load fetch group should be part of the 
fetch strategy, and no post-fetch analysis should be done. The only time the 
load fetch group is used is if a field f is accessed and it's not already 
fetched. 

The intent of the load fetch group is to augment the fetch plan under which the 
persistent instance was fetched. It's designed to provide an intelligent fetch 
strategy for the lower-usage cases where some use needs field f1 (not in any 
fetch group in the current fetch plan) and when using field f1 you want to also 
fetch fields f2, f3, and f4, that are also not part of the current fetch plan.


> LoadFetchGroup annotation was not recognized during the fetch1
> --------------------------------------------------------------
>
>                 Key: OPENJPA-370
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-370
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.0.1, 1.1.0
>            Reporter: Teresa Kan
>            Assignee: Teresa Kan
>             Fix For: 1.0.1, 1.1.0
>
>         Attachments: OPENJPA_370_2.patch, TestFetchGroup.zip
>
>
> Employee class has a LoadFetchGroup annotation defined on the Rating field, 
> when getRating was called, the address should be returned also. However, 
> openjpa did not handle the LoadFetchGroup correctly, therefore, address was 
> not eargly fetched.
> public class FGEmployee{
>     @Id
>     private int id;
>  
>     @OneToOne(fetch=FetchType.LAZY) 
>     private FGAddress address;
>  
>     @Basic(fetch=FetchType.LAZY)
>     @LoadFetchGroup("AddressFetchGroup")
>     private String rating;
>  
>     @ManyToOne(fetch=FetchType.LAZY)
>     private FGManager manager;
> ..
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to