fixing JPA queries