getSingleResult() optimization