You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by David Goodenough <da...@btconnect.com> on 2008/08/01 11:53:28 UTC

Is there a description of how lazy fetch works somewhere

I like the JPA API, in particular the cache which means that all object are
unique and the way that they notice that they are updated and remember
to save themselves when given the opportunity.

But, I am writing fat-client EJB code, and there does not appear to be
a generic remote Entity Manager that I can use so that my EJB logic on
the server can manage what goes on (like security) while enabling my
client to have a JPA interface to the datastore.

I only want the database exposed to the server, so that only application
mediated access is permitted.

EclipseLink seems to have one, but its not really documented and they
seem to think that really it should not exist and should be removed.

Anyway, before I came across the EclipseLink one, I had started to write
by own remote entity manager, which did not do the remote queries
(all the data comes from EJBs on the server) but does provide means for
managing the object cache and flushing changes through to the server
via an EJB so that the EJB can enforce rules.  

Currently the code is JPA implementation agnostic, but it does need all the
entities to be beans, with property change support.  For me this is not a 
great problem as I am also using beansbinding to attach the objects to the
screen widgets and that requires property change support as well.

I now have this working, but at the moment I can only handle FetchType.EAGER
fetches, not LAZY ones.  This is fine for small systems, but for larger 
datasets will be unworkable.  So I want to include LAZY fetch, but reading the
code I got confused and was wondering if anyone has written a design 
document or a paper analyzing the various lazy fetch implmentations.  I 
realise that this is going to make my code OpenJPA specific, but I do not 
mind that.

David