Using entity manager instead of session API