improved jpa performance -> sequence, code refactored