openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@gmail.com>
Subject Re: Lazy load for detached entities
Date Tue, 11 Sep 2007 14:51:49 GMT
> The idea is that Toplink JPA supports that feature. OpenJPA - no.
> Maybe this can be done as some configurable behaviour ?

They do, but really, all that they are doing is hiding the open EM. In
other words, the objects are not actually really detached yet.

What type of application are you building? Most server frameworks
these days have some sort of request boundary concept, such as a
ServletFilter; given such a concept, it's trivial to register an EM
with a ThreadLocal or some equivalent construct at the beginning of
the request, and close the EM when the context closes.

-Patrick

On 9/11/07, Evgeny Shepelyuk <eshepelyuk@gmail.com> wrote:
> > Hi,
> >
> > Lazy loading is not available for detached entities -- by definition,
> > they are no longer associated with the database.
> >
> > You can, however, control whether OpenJPA returns null or throws an
> > exception when an unloaded field is accessed.
> >
> > If you want to be able to lazily access a field after a transaction
> > completes, you might want to consider keeping the entity manager open
> > for the duration of your request.
> >
>
> The idea is that Toplink JPA supports that feature. OpenJPA - no.
> Maybe this can be done as some configurable behaviour ?
>
> --
> Best Regards
> Evgeny K. Shepelyuk
>


-- 
Patrick Linskey
202 669 5907

Mime
View raw message