openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From SomuReddy <>
Subject Re: EntityManger close against the Query and lazy Loading
Date Wed, 16 Jan 2008 16:53:57 GMT

Hi Alexander,

Thanks for your information, but I am not using the any join( LEFT JOIN
FETCH)  in query, I am just specifying the relationship like this..

@OneToMany(mappedBy = "fireRsrcDO", cascade = CascadeType.PERSIST)
    List<FireRsrcVersionDO> fireRsrcVerDOList = null;

by defaullt OneToMany fatch type is "lazy loading", so problem is when i
close the EntityManager after execution of query(Query is  executing on one
of the dataobject where i specified all these relationships) , data is not
Can i use the fetch groups here???


Alexander Saint Croix-2 wrote:
> Hi.
> 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.
> HTH,
> --
> 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

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message