KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a question related to correct handling of returns of the DAO library I'm writing for one project. This library probably is going to be used by another people, and I want to do it correctly. How I should deal with return statements of the functions of my DAO? Example 1 I have function to getCustomer which should return String. In case a query doesn't return any result should I return null, an empty string or throw some kind of exception? Example 2 I have a function, getCutomerList , which returns a value of type ArrayList<String>. In case a query doesn't return any result should I return null, an empty ArrayList or throw some exception? Example 3 Some SQL exception was detected, what should I do, throw exception or do try .. catch of the block where it can occur? What is the "good" practice or "best" practice to apply in my case?
Tags (comma-separated)
Save Edits
Cancel