openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Re: result of MAX on empty table is 0
Date Thu, 09 Sep 2010 15:52:09 GMT
Are you asking a question? ... or are you just asserting that it works as
defined in the spec?

Thanks,
Rick

On Thu, Sep 9, 2010 at 9:32 AM, Vera Filippova <oakjumper@gmail.com> wrote:

> 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