Solving some EntityManager issues.