openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vera Filippova <oakjum...@gmail.com>
Subject result of MAX on empty table is 0
Date Thu, 09 Sep 2010 14:32:51 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message