Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Proper EntityManger in multi-thread App(Is there a proper procedure for using entity managers in a multi-thread application.)
Proper EntityManger in multi-thread App [message #905141] Wed, 29 August 2012 15:38 Go to next message
Eclipse UserFriend
Is it better to have an entity manager per thread, when shared cache is off, or only open and close an entity manager when you write to the database? This comes from the ConcurrancyManager.acquire() method hanging, for what i can tell is no valid reason. Would separate entity managers per thread solve this?
Re: Proper EntityManger in multi-thread App [message #905333 is a reply to message #905141] Thu, 30 August 2012 03:31 Go to previous messageGo to next message
Eclipse UserFriend
On 2012-08-29 21:38, Chad Curtis wrote:
> Is it better to have an entity manager per thread, when shared cache is off, or only open and close an entity manager when you write to the database? This comes from the ConcurrancyManager.acquire() method hanging, for what i can tell is no valid reason. Would separate entity managers per thread solve this?

AFAIK an EM is not thread save, so if multiple threads are accessing the same EM, you should either synchronize them, or use separate EM's for each thread.
Re: Proper EntityManger in multi-thread App [message #908652 is a reply to message #905333] Wed, 05 September 2012 14:33 Go to previous message
Eclipse UserFriend
Thanks for the advice, I went with multiple entity mangers.
Previous Topic:jboss tools hibernate is getting error while installing @ eclipse indigo sr2
Next Topic:Eclipselink 2.3.2 + composite persistence units + bean validation (jsr303)
Goto Forum:
  


Current Time: Tue Jul 08 05:46:30 EDT 2025

Powered by FUDForum. Page generated in 0.04255 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top