geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tornike <>
Subject EntityManager & Servlets
Date Mon, 31 Aug 2009 10:48:13 GMT

I was trying to follow the examples that are given in the Geronimo
documentation to understand JPA. In lot of sources I have read that
EntityManager is not thread safe and it should not be injected into the
servlet. (container managed one) However in the example of ejb-JPA 
it is being injected in the servlet.  
public class Test extends javax.servlet.http.HttpServlet 
 implements javax.servlet.Servlet {

 static final long serialVersionUID = 1L;

 private EntityManager em;
I have tested the example works without problems so are there conditions
when it can be done or am I understanding it the wrong way?
View this message in context:
Sent from the Apache Geronimo - Users mailing list archive at

View raw message