openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: Injecting EntityManager to a web controller
Date Wed, 06 Jun 2007 15:28:31 GMT

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; 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 jencks


> Is 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/


Mime
View raw message