Proper Usage of Entity Manager from EntityManagerFactory
===

I am having some trouble understanding the proper usage of entity manager when querying for objects and or deleting/creating. Right now for any database transactions i have several service methods which open and close new entity managers like so:

    public static Long getCountApplicants(String active){
        	
        EntityManager entityManager = factory.createEntityManager();
        long value = (Long) entityManager.createQuery("select count(distinct a) from    Applicant a  where a.active = " +active).getSingleResult();
        System.out.println("get count app query");
        entityManager.close();
        return value;
        }
Since i have a Java EE app with a persistence.xml file that defines my unit, why cant i declare only one from my factory and use it throughout the life of my app? is there any performance, memory leak issues with using just one of these objects?

