0 Replies Latest reply on Feb 1, 2007 6:20 AM by Rabbia Qaswar

    @PersistenceUnit OR @PersistenceContext EntityManagerFactory

    Rabbia Qaswar Newbie

      Hello

      I am using JTA API for my application. Wanted to know a simple thing before starting the work. What is the better approach to obtaining a EntityManager in an EnterpriseBean.

      Tech. no 1:
      @PersistenceUnit
      EntityManagerFactory emf;
      EntityManager = emf.createEntityManager();

      OR

      Tech. no 2:
      @PersistenceContext
      EntityManager em;