code: @Nonnull
    public static final Number getSelectCountResultObj (@Nonnull final Query aQuery)
    {
      final Number ret = (Number) aQuery.getSingleResult ();
      return ret != null ? ret : Integer.valueOf (0);
    }
docs: Helper method to handle the execution of "SELECT COUNT(...) ..." SQL
  statements. To be invoked inside a {@link #doSelect(Callable)} or
  {@link #doSelectStatic(Callable)} method.
  
  @param aQuery
  The SELECT COUNT query
  @return a non-negative row count