At 05:07 PM 6/24/2002, you wrote:
>I think it is more likely that calling retrieveByPK returning 0 results
>is an error than doing so with a Map get method call.  Where did the PK
>that returned 0 results come from?  There is a pending patch to make the
>exception vs. null configurable with a propery.  I'm not sure I want to
>go this way though.  Can anyone provide me with some use cases that
>supports the use of null vs. throwing an exception.  i.e. when is it not
>an exceptional condition?

Here's a simple code fragment that shows an obvious use case:

username = request.getParameter("username");
User u = UserPeer.retrieveByPK(username);
if (u == null) {
         response.sendRedirect("noSuchUser.jsp");
} else {
         request.getSession().setAttribute("loggedInUser", u);
}


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to