Where and how handle spring+hibernate exceptions? Where and how handle spring+hibernate exceptions? spring spring

Where and how handle spring+hibernate exceptions?


I would suggest wrapping the thrown exceptions in your own exception class and letting them bubble up to the GUI layer.


If you're using Spring MVC, then there's a solution of writing ExcpetionHandlerResolver, take at the look on the documentation

If you're not working with Spring MVC. i would suggest throwing the exception from DAO to Service and then to View layer. Only the view layer can really provide valuable information to the user based on the exception caught.