added support for entity manager