openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pinaki Poddar (JIRA)" <>
Subject [jira] Commented: (OPENJPA-370) LoadFetchGroup annotation was not recognized during the fetch1
Date Wed, 31 Oct 2007 22:45:50 GMT


Pinaki Poddar commented on OPENJPA-370:

> In a nutshell, LoadFetchGroup just didn't work per the documentation (or maybe our interpretation
of the documentation). 

This statement -- the root of this change -- may require more validation. I have recently
tried to verify LoadFetchGroup behavior with few tests and they are coming out positive. At
this point, I will not contest the observation as my tests may not  cover many variations.
Yet, even if the above statement is true, we should first investigate why the existing (i.e.
before Teresa's patch) mechanics is not working.    
The 'existing mechanics' is more in the spirit of how Craig has explained and elaborated LoadFetchGroup.
Essentially, LoadFetchGroup is *not* taken into account when data is loaded from datastore.
It is where the tight inner-loop evaluates for each field if it is to be 'fetched' from the
datastore. Given high frequency of this evaluation -- Patrick's concern on performance degradation
is certainly valid. 

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

See for details:

     * Load the given field's fetch group; the field itself may already be
     * loaded if it is being set by the user.
    protected void loadField(int field, int lockLevel, boolean forWrite,  boolean fgs) 

> LoadFetchGroup annotation was not recognized during the fetch1
> --------------------------------------------------------------
>                 Key: OPENJPA-370
>                 URL:
>             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,
> 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.

View raw message