This is as per the getSingleResult() JavaDoc.
List result = entityManager.createQuery("from Student s where s.name='John'").getResultList(); if ( result.size() == 0 ) ...
Thanks for reply.
I tried the code that you suggested, using getResultList() instead, but I still got the same exception.
If both methods throw exception in case of Entity not found, which exception should I catch?
Could you point me to the right javadoc? Thanks for help.
EntityNotFoundException. Working well. Thanks.