On Wed, Jul 15, 2009 at 8:38 AM, Peter Henderson <
[email protected]> wrote:

> I am using the PersistenceManager using a ContextListener suggested here
> [2]
>
>
> *UPDATE*
>
> It seems like a threading issue. If both threads try and call the query
> concurrently I get the error. Placing a Thread.sleep(5000) in one of them
> seems to solve the issue.
>
> I was under the impression EntityManagerFactory.getEntityManager() was
> thread safe?
>


> [2] Persistence Manager using Context Listener
>
> http://javanotepad.blogspot.com/2007/05/jpa-entitymanagerfactory-in-web.html
>

The first comment on the above article suggests a multi-thread problem.
While I don't think you'd want to synchronize the method that initializes
the factory, you might try it to see if it fixes the problem.

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:[email protected]

Reply via email to