Fixing database set enconding and make a singleton on a entity manager