aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Why NoResultException? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Why NoResultException?" Watch "Why NoResultException?" New topic
Author

Why NoResultException?

K Karthik
Greenhorn

Joined: Jul 05, 2007
Posts: 11
I was wondering as why javax.persistence.Query class throws NoResultException on calling getSingleResult() or getResultList() when there is no results? Won't it be more logical if they return 'null'? Also, rather than making NoResultException to be caught mandatory, they have made it a runtime exception. Since it is very common for a query to return no results, this should have been made a mandatory exception, if at all they are going to throw it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why NoResultException?