openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C N Davies" <>
Subject LazyLoading hell resolved
Date Thu, 29 Apr 2010 16:19:44 GMT
Finally I managed to sort out one of my major performance issues with
OpenJPA, but to do so I feel like I'm sacrificing good design.


I have a simple Entity:


public class LoadHeader ...{



 private List<dataline> data;


public int getData(){

                return data;




If I put in my jsf page;



<h:outputtext value="#{}"/>


OpenJPA will load my "data" vector so it can calculate the size of the list.
I can see why it might work this way but since this LoadHeader instance
might contain 100,000 items of complex entities,  just accessing the size of
the vector causes the list to load  taking 2+ minutes.  Removing the
reference to the vector "size"  method allows lazy loading to work just
fine, so I ended up adding a new "int dataCount" member to my LoadHeader.
>From a design perspective this is quite poor because I have to ensure that I
keep the "dataCount" member synchronised with the "size" of the actual


Is this really how I am supposed to be designing my app with OpenJPA?








Neil Davies




Mobile:  +61 403 655872




  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message