lazy create entity manager, begin transaction and commit, close when exiting