I always get an null pointer exception because the results list is null and not empty. I thought that "problem" has been solved?
Query query = em.createNamedQuery("findMaxTranslationId");
query.setMaxResults(1);
List<Long> results = query.getResultList();
System.out.print(results); //Output = [null]
Long translationId = 1L;
if (!results.isEmpty()) {
translationId = results.get(0); //null pointer exception
}
return translationId;
Query:
SELECT MAX(t.translationId) FROM Translation t
I also tested the query manually and it is working.