Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Not retreiving OneToMany collections with lazy and eager option

Hello Kiran,

From the sounds of it, the OneToMany is mapped by a OneToOne back pointer, and are maintaining relationship changes through the OneToOne but not the OneToMany. If you set one side of a bi directional relationship, the application must also maintain the other side as well or the cache becomes out of synch with what is in the database until a refresh occurs. Invalidating the objects is essentially forcing a refresh, which causes the OneToMany to be queried from the database. When you add/remove from a relationship, the application will also need to add/remove from the OneToMany collection as well.

Best Regards,
Chris

On 22/11/2010 6:01 AM, Kiran Kumar Gubbi wrote:
Hi all,

I am currently trying to improve performance of our application . One of the
thing I wanted to use is lazy loading of oneToMany collections. But it looks
like the data is not retrieved eventhough it is present in the database. The
scenario is we upload the application form through web service, it generates
the form  data and if the form is not valid it generates rejection list in
the database. On looking for this same form on our web application the
rejection list is not retrieved from the database. I have used fetch type is
lazy for this collection. One thing we have noticed that after clearing
cache using the following code from the screen the rejection list start
appearing on the screen.
( ( JpaEntityManager ) getEntityManager().getDelegate()
).getServerSession(). getIdentityMapAccessor().invalidateAll();
Is there something I am missing here ?

My colleague observed even Eager fetching is not working .

Thanks,

Kiran




Back to the top