Author
What is the need for creating a Exception for DAO Layer
PavanPL KalyanK
Ranch Hand
Joined: Feb 28, 2009
Posts: 212
What is the need for creating a Exception for DAO Layer like in this code below :
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26496
To tell you something went wrong in the database layer? Can you expand on your doubt?
[Blog ] [JavaRanch FAQ ] [How To Ask Questions The Smart Way ] [Book Promos ]
Blogging on Certs: SCEA Part 1 , Part 2 & 3 , Core Spring 3 , OCAJP , OCPJP beta , TOGAF part 1 and part 2
PavanPL KalyanK
Ranch Hand
Joined: Feb 28, 2009
Posts: 212
Jeanne Boyarsky wrote: Can you expand on your doubt?
Jeanne thanks for the reply, My doubt is that
DAOException is a Checked or a RuntimeException ? and how the client (Servlet ) should handle this ??
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted Apr 05, 2009 10:43:08
0
It is not necessarily to be called "DAOException". It is just a homegrown class which you use to hide the specific exceptions of the wrapped database communication API, like JDBC or Hibernate. If you already have the class, just check if it extends Exception or RuntimeException , then the remaining is fairly self-explaining.
Also see this article: http://balusc.blogspot.com/2008/07/dao-tutorial-data-layer.html (do not only scan the code/article, but also read the text).
Code depot of a Java EE / JSF developer | JSF / Eclipse / Tomcat kickoff tutorial | DAO kickoff tutorial | I ♥ Unicode
subject: What is the need for creating a Exception for DAO Layer