Fix 'EntityManagerFactory is closed' error
Static entityManagerFactory should always be updated. Otherwise when it closed it can never be replaced with a new one (e.g. in a unittest).
Static entityManagerFactory should always be updated. Otherwise when it closed it can never be replaced with a new one (e.g. in a unittest).