Hi Peter, Another item to try is to turn off the sql generation cache. I'm taking a long shot here, but the call stack shows that we're attempting to get the query from the cache. If there's a problem with synchronizing the cache access, then turning it off would help isolate the problem. Documentation for this sql generation cache can be found here [1], but to turn it off just set this property:
<property name="openjpa.jdbc.QuerySQLCache" value="false"/> Kevin [1] http://openjpa.apache.org/builds/1.2.1/apache-openjpa-1.2.1/docs/manual/manual.html#ref_guide_cache_querysql On Wed, Jul 15, 2009 at 7:51 AM, Daryl Stultz <da...@6degrees.com> wrote: > On Wed, Jul 15, 2009 at 8:38 AM, Peter Henderson < > peter.hender...@starjar.com> 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:da...@6degrees.com >