Result of aggregate function MAX is 0 on empty table.
I can find in JPQL reference "If SUM , AVG, MAX, or MIN is used, and there
are no values to which the aggregate function can be applied, the result of
the aggregate function is NULL."

        // The following example will print [0]
        String query = "SELECT MAX(obj.number) FROM " +
Bean.class.getSimpleName() + " obj";
        System.out.print(em.createQuery(query).getResultList().isEmpty());

With openjpa 1.2.1 this example will print [null] as expected.

Thank you
-- 
Vera Filippova

Reply via email to