On Jun 6, 2007, at 8:28 AM, David Jencks wrote:
On Jun 6, 2007, at 5:03 AM, Joshua Jackson wrote:Dear all, If I deploy my webapps to a server that has OpenJPA in it (let's say Geronimo). How do I inject EntityManager to my web controller?I'm not sure what your web controller might be. You can inject an entity manager into a servlet or jsf managed bean using an @PersistenceContext annotation
You can only inject an EM into a servlet if the servlet is single- threaded. You need to inject an EMF.
You can inject an EM into a jsf managed bean if it is defined as request scope IIUC.
Craig
; the related annotations for EMF or getting an EM into jndi also work the same as for ejbs. You can't get an EM injected into a non- managed object that you create yourself, for such an object you would have to look it up in jndi yourself.thanks david jencksIs it the same way as shown in OpenJPA examples? Thanks in advance -- Let's create a highly maintainable and efficient code YM!: thejavafreak Blog: http://www.nagasakti.or.id/roller/joshua/
Craig Russell Architect, Sun Java Enterprise System http://java.sun.com/products/jdo 408 276-5638 mailto:[EMAIL PROTECTED] P.S. A good JDO? O, Gasp!
smime.p7s
Description: S/MIME cryptographic signature
