0 Replies Latest reply on Aug 30, 2010 9:07 AM by Júlio Reis

    acessing the database out of the Stateless Session Bean

    Júlio Reis Newbie

      Hi.. everybody.. I'm new on EJB with JBOSS and JPA.

       

      I'm trying to access a database using

       

      EntityManagerFactory emf = Persistence.createEntityManagerFactory("test");
      EntityManager em = emf.createEntityManager();
      and I'm getting the following error:
      javax.persistence.PersistenceException: No Persistence provider for EntityManager
      but it is a call in a class out of the SessionBean Class.
      in the sessionBean class I'm using (see below) in order to get the entityManager
      @PersistenceContext
      private EntityManager em;
      however I also need to acess the database out of the sessionbean class. For that, I have tried the EntityManagerFactory without success.
      I'm new on it, and I don't have any idea to solve it.
      Could you please help me in how I can overcome such problem?
      Kind Regards
      Júlio