This content has been marked as final.
Show 3 replies
-
1. Re: Query.getSingleResult throw Exception
epbernard Aug 5, 2005 2:57 PM (in response to javatwo)This is as per the getSingleResult() JavaDoc.
UseList result = entityManager.createQuery("from Student s where s.name='John'").getResultList(); if ( result.size() == 0 ) ...
-
2. Re: Query.getSingleResult throw Exception
javatwo Aug 5, 2005 3:14 PM (in response to javatwo)HI Emmanuel,
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. -
3. Re: Query.getSingleResult throw Exception
javatwo Aug 5, 2005 3:41 PM (in response to javatwo)I catch
EntityNotFoundException. Working well. Thanks.