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 singleNULLresult, so no exception should be thrown.Aggregate functions return
NULLif there are no rows for which to calculate the aggregate, which makes this a bit convoluted. The query itself (FROM IptReceiveOrder...) returns0rows, but theMAX(model.id)changes that into a singleNULLrow.