Changed deprecated getEntityManager