fix tests + fix sort for jpa entities