Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Accessing a lazy-field of a managed entity in another thread

When speaking in general JPA, you should avoid sharing managed Entities / EntityManagers across threads. Unfortunately I don't have first hand experience in this area with EclipseLink, but some of my previous experiences with other providers tells me this is a bad idea. 

Hopefully someone else on the list has some more concrete information for you.

Thanks,
Rick

On Wed, Feb 25, 2015 at 1:58 PM, Andreas Joseph Krogh <andreas@xxxxxxxxxx> wrote:
Hi all.
 
Say I have this code:
 
Person person = em.find(...)
asyncDispatcher.process(person) // hands managed entity to another thread
 
Then some other thread calls person.getLazyMappedCollection.foreach(...)
 
Is this safe or may it result in all sorts of exceptions and/or resource-leaks (sql.Connection/ResultSet leak etc.)?
 
Thanks.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



--
Rick Curtis

Back to the top