openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Saint Croix" <>
Subject Re: EntityManger close against the Query and lazy Loading
Date Wed, 16 Jan 2008 15:18:52 GMT

You should look into using the LEFT JOIN FETCH clause in your query, and
perhaps should also look at whether some of your collection valued
references can be set to FetchType.EAGER without causing the cascading to
spiral out of control and pull down the entire database.  A third solution
is to look into using Fetch Groups.

Alexander R. Saint Croix
(a user, like you)

On Jan 15, 2008 3:05 PM, SomuReddy <> wrote:

> Hello,
> I am creating the own EntityManger for each query to execute?  is it
> required to close the EntityManger after execution of the each Query, I
> have
> lazy loading(fetch type) on my data objects with some relationships(like
> OnetoMany, ManytoOne and ManytoMany), If I close the EntityManger after
> the
> Query execution, i couldn't  get data thru relationships as it defined
> fetch
> type is "Lazy" and EntityManger is no more active.
> is there any other soultion except changing the fetch type is from lazy to
> Eager.. or I  should not close the EntityManger after query execution, If
> I
> won't close the EntityManager what are the Cons?????
> when EntityManager instance will be garabage collect????
> Any idea on this???
> --
> View this message in context:
> Sent from the OpenJPA Users mailing list archive at

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