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

Chris Geer commented on RAVE-876:
---------------------------------

Trevor, thanks for the patch. We went down this road once before but ran into 
problems where the object would become disconnected from the EntityManager and 
the Lazy load wouldn't be triggered and the object would just return empty 
lists. I haven't had a chance to try your patch yet but if I remember 
correctly, the places we had problems would be with things like WidgetComments. 
You could enter one but they would never be returned.

I'll try and test the patch this weekend.

Chris
                
> Change to fetch Collections on JpaWidget lazily instead of eagerly.
> -------------------------------------------------------------------
>
>                 Key: RAVE-876
>                 URL: https://issues.apache.org/jira/browse/RAVE-876
>             Project: Rave
>          Issue Type: Improvement
>          Components: rave-jpa
>            Reporter: Trevor Mack
>            Priority: Trivial
>         Attachments: [RAVE-876]_-_JpaWidget_Lazy_Loading_Collections.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> On page load there are a number of objects that get populated (either from 
> cache, if implemented, or via database provider) for the @JoinColumn 
> attributes on a JPAWidget because FetchType is set to EAGER.
> For a vanilla instance of Rave this is overly excessive since the Widget in 
> order to render doesn't require Ratings, Comments, Tags, or Categories this 
> should be set to FetchType.LAZY to allow the JPA provider the ability to add 
> efficiency in the server's time rendering the base page layout / html.
> ---------------------- initial email contents ----------------------
> I have been spending sometime in looking at the effecency of a RAVE extension 
> and discovered that on initial page load (and every page load after that) 
> there is some excessive database / cache calls being made to populate the 
> model. Taking a look at the JPA configuration I pinned it down to how OpenJPA 
> is creating the JpaWidget model as there are a number of parameters being 
> fetched, though never used the following list shows this:
> - List<JpaWidgetComment> comments (ln #184)
> - List<JpaWidgetRating> ratings (ln #202)
> - List<JpaWidgetTag> tags (ln #206)
> - List<JpaCategory> categories (ln #214)
> These attributes are only displayed within the store and IMHO are not needed 
> to be EAGERLY fetched. Changing this to the more common FetchType.LAZY. The 
> default usually is to load Collections lazily while loading attributes 
> eagerly. [1]
> If there aren't any objections I am going to submit a patch this afternoon, 
> created a ticket within JIRA (my first contribution to RAVE!)

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