1 Reply Latest reply on Oct 29, 2005 5:54 PM by sventura

    getSingleResult behaviour mismatch for count() and sum() whe

    sventura

      Is is normal that

      Number num
       = (Number)entityManager.createQuery(
       "select count(*) from X x;")
       .getSingleResult();


      works ok, and

      Number num
       = (Number)entityManager.createQuery(
       "select sum(x.id) from X x")
       .getSingleResult();


      throws EntityNotFoundException when X has no entities at all?

      I expected (since both functions are agregated) none will rice an exception and just return zero.

      @Manifest
      Too sorry in advance if this is documented else where.