You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Joshua Jackson <jo...@gmail.com> on 2007/06/01 11:22:07 UTC
Injecting Entity Manager to POJO/Form Bean
Dear all,
How do I get the EntityManager injected to my web Form Bean / POJO?
Currently I'm deploying my apps that uses openjpa as the persistence
implementation on an appserver, but I still can not get the
EntityManager injected in my POJO. Where can I find the reference
regarding this?
Thanks in advance
--
YM!: thejavafreak
Blog: http://www.nagasakti.or.id/roller/joshua/
Re: Injecting Entity Manager to POJO/Form Bean
Posted by Craig L Russell <Cr...@Sun.COM>.
Hi Joshua,
The only POJOs that you can inject are server components, e.g.
ManagedBean or SessionBean. You can find the complete list in the EJB
3 specification.
Regular POJOs cannot be injected.
Craig
On Jun 1, 2007, at 2:22 AM, Joshua Jackson wrote:
> Dear all,
>
> How do I get the EntityManager injected to my web Form Bean / POJO?
>
> Currently I'm deploying my apps that uses openjpa as the persistence
> implementation on an appserver, but I still can not get the
> EntityManager injected in my POJO. Where can I find the reference
> regarding this?
>
> Thanks in advance
>
> --
> 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:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!
Re: Injecting Entity Manager to POJO/Form Bean
Posted by David Jencks <da...@yahoo.com>.
Support for this is completely part of the appserver and not part of
openjpa. Are you sure your appserver is completely javaee5 compliant?
A couple of comments....
you use a PersistenceContextRef annotation or the equivalent xml
the object the EntityManager is to be injected into can't be some
arbitrary class, it has to be managed in some way by the app server,
such as an EJB class, servlet, app client main class, app client
CallbackHandler, or jsf managed bean. Furthermore the container has
to create it, not your code.
thanks
david jencks
On Jun 1, 2007, at 2:22 AM, Joshua Jackson wrote:
> Dear all,
>
> How do I get the EntityManager injected to my web Form Bean / POJO?
>
> Currently I'm deploying my apps that uses openjpa as the persistence
> implementation on an appserver, but I still can not get the
> EntityManager injected in my POJO. Where can I find the reference
> regarding this?
>
> Thanks in advance
>
> --
> YM!: thejavafreak
> Blog: http://www.nagasakti.or.id/roller/joshua/