Replaced deprecated calls (getEntityManager)