Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why NoResultException?

 
K Karthik
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic