I went through the document I fount NoResultException - if there is no result ,but when I am executing the query its shows null;
As the single result return type is Object we need to typecast the result into the class Object if we typecast the null with Object no Exception will arise.
can any one give clarity, when it will give an NoResultException ?
There's a difference between the lack of results (no rows) and NULL
. What you're getting is a single NULL
result, so no exception should be thrown.
Aggregate functions return NULL
if there are no rows for which to calculate the aggregate, which makes this a bit convoluted. The query itself (FROM IptReceiveOrder...
) returns 0
rows, but the MAX(model.id)
changes that into a single NULL
row.