You seem to be using JPQL, that is Java Persistence Query Language. MySQL and JPQL (or Hibernate) are completely different query languages and each of them has their own specific syntax. The LIMIT construct is available only in MySQL and it is not part of any SQL standard. The functionality in JPA is simulated by setting maximum number of results on the query
object.
So instead of LIMIT 1
you should use
query.setMaxResults(1);