persistence@glassfish.java.net

Re: new to glassfish and EJB3- problem with EntityManager

From: Kenneth Saks <Kenneth.Saks_at_Sun.COM>
Date: Mon, 26 Jun 2006 10:49:29 -0400

Bob Treacy wrote:

>I am just getting started with Glassfish and EJB3.
>What could be causing the first line of findAll()
>below to be generating a NullPointerException?
>
Hi Bob,

Can you post the stack trace? How are you accessing the local session
bean? Make sure you are using either @EJB or a lookup to access
the local ejb reference instead of directly instantiating the StudyFacade
class.

 --ken

>
>@Stateless
>public class StudyFacade implements StudyFacadeLocal {
>
> @PersistenceContext
> private EntityManager em;
>...
> public List findAll() {
> Query q = em.createQuery("SELECT object(s)
>from Study as s");
>..
>
>}
>
>Thanks,
>Bob Treacy
>
>