3 Replies Latest reply on Feb 16, 2007 9:32 AM by Stan Silvert

    EJB dependency injection

    Alexander Petrov Newbie

      Hello I have a "small" problem with the @EJB anotation.
      I have created the following Bean:

      @Stateless
      public class CathegoryFacadeBean implements CathegoryFacadeRemote {
      @PersistenceContext(type=PersistenceContextType.TRANSACTION) EntityManager em;

      public List getAllCathegories() {
      List cats = em.createNamedQuery("findAllCathegory").getResultList();

      return null;
      }

      }

      I am then using

      @EJB CathegoryFacadeRemote cathegories;

      from a JSF Backing bean. But the cathegories is null! I also tried to specify the "name" attribute of the anotation but no success. Can you tell me what to do in order to use the dependency injection?
      Thank you in advance