Hi,
On Tue, Nov 06, 2007 at 12:47:41PM -0800, edu53 wrote:
> I'm new using JPA (GlassFish V2 Server, TopLinks, NetBeans IDE) and have the
> following problem:
> In a managed bean that uses resource injection, i.e
>
> @PersistentContext
> private EntityManager em;
>
> When calling em.persist(entity) always get a java.lang.NullPointerException,
> no matter what entity trying to persist.
> I'm not sure if resource injection is working.
Resource injection cannot be done out of JSF managed beans, since they do not
live inside the entity container. Getting hold of a (local or remote) session
bean from which you use the EntityManager is one way to solve this.
HTH, Wouter van Reeven
--
People: "If she weighs the same as a Duck, she's made of wood!"
Sir Bedevere: "And therefore...?"