Hello,

We have a web application where entity managers are bound to a thread for the 
request duration and at the end of the request the entity manager is closed and 
removed from the thread.

When the entity manager is incorrectly shared between threads, and the 
“Multiple concurrent threads attempted to access a single broker. By default 
brokers are not thread safe; if you require and/or intend a broker to be 
accessed by more than one thread, set the openjpa.Multithreaded property to 
true to override the default behavior.” is thrown, we can’t close the entity 
manager as it will throw the same exception.

Is it safe to assume that the entity manager doesn’t need to be closed when 
it’s in that state and it’s just enough to remove it from the thread? Meaning 
that the EntityManagerFactory doesn’t pool or share entity managers and it 
always creates a new one?

OpenJPA version in use: 3.1.0.

Thanks,

--
Tuomas Hynninen
Senior Software Engineer
Surveypal Oy

Reply via email to