I wanted to check the a particular entry is already in database table.
For instance, when the user is registered, I wanted to check whether the username and dob is already there in the
table. If it is there I wanted to show it in client that it is already there.
In this scenario, do I need to create custom exception? if custom exception is required should it be checked or unchecked
exception? I am quite confused in which scenario I would use checked and unchecked exception? And if the custom exception
has to be written,dont I need to pass the username and dob as parameters to the custom exception?
Otherwise if just the exception has to throw we can use either throw new exception("username"+usernmae+" and "+dob+" already exists")
or
throw new RuntimeException("username"+usernmae+" and "+dob+" already exists").