I'm doing an EJB query, where I'm getting the sum of a value of some objects. If that query doesn't match any objects (rows), the value being returned is null. Does this make sense, or is there some other problem in my query?
I did some experiments with some more queries, and indeed, it looks like if you take the sum() of an empty set of objects you get null, not zero. I just checked it and I get the same behavior in SQL itself.