The moose likes Other Application Frameworks and the fly likes How to handle data-access exceptions in Spring ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Other Application Frameworks
Reply Bookmark "How to handle data-access exceptions in Spring ?" Watch "How to handle data-access exceptions in Spring ?" New topic
Author

How to handle data-access exceptions in Spring ?

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3334

Hi.
I have been checking PetClinic example of Spring framework in order to know how to handle exceptions in Spring&Hibernate&Web-based interface.
The example throughs DataAccessException which is a sucbclass of RuntimeException.
When an exception accured at Hibernate level, a stack trace web page is displayed.
This is not what I want to do -I can't let the user see this page, it is unfriendly-.
So, how to handle data access exceptions in Spring&Hibernate&Web interface ?
Thanks.
Sabarish Sasidharan
Ranch Hand

Joined: Aug 29, 2002
Posts: 73
What are you using at the web layer? If using struts, you can define an a general exception handler for dataaccessexception. And for specific cases of data access exception, you might want to catch them in the Action layer and render differently.


Sab<br /> <br />Perfection does not come from belief or faith. Talk does not count for anything. Parrots can do that. Perfection comes through selfless work.<br />Swami Vivekananda
 
 
subject: How to handle data-access exceptions in Spring ?
 
Threads others viewed
Spring, in Spring-Struts-Hibernate application
New book published: Spring Recipes: A Problem-Solution Approach
How to handle exceptions in Spring
hibernate+spring
Exception handling in web involves Spring Hibernate and Struts
MyEclipse, The Clear Choice