Re: EntityManager & Servlets

2009-09-15 Thread tornike
>>> >>> public class Example extends HttpServlet { >>> @PersistenceUnit >>> private EntityManagerFactory emf; >>> >>> @Override >>> protected void doGet(HttpServletRequest request, HttpServletResponse >>> response) >>> throws ServletException, IOException { >>> EntityManager em = emf.createEntityManager(); >>> // do stuff >>> >>> -- >>> Fredrik Jonson >>> >>> >>> >> > > -- View this message in context: http://www.nabble.com/EntityManager---Servlets-tp25221488s134p25461383.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.

Re: EntityManager & Servlets

2009-09-15 Thread Fredrik Jonson
Jay D. McHugh wrote: > Geronimo should not allow you to add container managed entity > managers to servlets. They would not be thread safe. Then please examine the example again. You're correct that there's a stateless bean acting as a accessor in _part_ of the example. But there is also a serv

Re: EntityManager & Servlets

2009-09-15 Thread Jay D. McHugh
Sorry for the late reply to this. Geronimo should not allow you to add container managed entity managers to servlets. They would not be thread safe. I haven't looked at the example in a while - but I believe it is using a stateless session bean to access the entity manager. That is perfectly ac

Re: EntityManager & Servlets

2009-08-31 Thread tornike
, HttpServletResponse > response) > throws ServletException, IOException { > EntityManager em = emf.createEntityManager(); > // do stuff > > -- > Fredrik Jonson > > > -- View this message in context: http://www.nabble.com/EntityManager---Servlets-tp25221488s134p25226546.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.

Re: EntityManager & Servlets

2009-08-31 Thread Fredrik Jonson
In <25221488.p...@talk.nabble.com> tornike wrote: > EntityManager is not thread safe and it should not be injected into the > servlet. (container managed one) However in the example of ejb-JPA > http://cwiki.apache.org/GMOxDOC21/container-managed-persistence-with-jpa.html > > I have tested th

EntityManager & Servlets

2009-08-31 Thread tornike
nabble.com/EntityManager---Servlets-tp25221488s134p25221488.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.