Hello,
I would like to put an entity manager instance into the ServletContext/application scope of a web application.
The reason for this is that I want to cache the results of a query (I want to use the query cache) and it seems that I need to put the entity manager either in session or in application scope in order for the query cache to work.
Now I am VERY worried about the thread safety issues or the perfomance issues of having only one entity manager instance for use by several clients.
My questions are therefore as follows:
-What are the implications regarding thread safety of having a single entity manager for use by several clients?
-What are the potential performance issues of having a single entity manager for use by several clients?
-If the solution of having one EM per web app is not feasible, then what other solution do you advise in order to be able to take advantage of the query cache?
Any clue welcome,
Thanks in advance,
Julien.
|