users@glassfish.java.net

Re: JEE 6 / Glassfish v3 / Eclipse - JPA Entity Manager Issues

From: Sahoo <Sahoo_at_Sun.COM>
Date: Fri, 09 Apr 2010 08:29:38 +0530

Who injects the entitymanager into the SLSB? The EJB container, right?
For container to inject, it has to intercept creation of the bean
instance. If you directly instantiate the SLSB in your managed bean, you
are by-passing the EJB container. To involve EJB container, you need to
get an instance from EJB container and you do that by using @EJB in your
code. Never directly instantiate managed objects.

Sahoo

glassfish_at_javadesktop.org wrote:
> Sahoo,
>
> You were 100% correct. For my own education; can you explain why I needed the @EJB annotation in my managed bean? I would of thought the @PersistenceContext annotation would inject the necessary code for the EntityManager to work.
>
> Thanks,
> Chris
> [Message sent by forum member 'iceman3479']
>
> http://forums.java.net/jive/thread.jspa?messageID=396027
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>