Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7988913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:35:47+00:00 2026-06-04T12:35:47+00:00

I develop an application using Struts, Spring, and Hibernate. My DAOs uses spring jdbc

  • 0

I develop an application using Struts, Spring, and Hibernate.

My DAOs uses spring jdbc and all its method throws DataAccessException(that is uncheked).

Where should I handle this exceptions? I know it’s an unchecked exception but I think I need to tell the user if there’s a problem with the db or it’s connection.

I think I should rethrow the DataAccessException from my service class methods to be catched by Controller.
Is this a good practice?

I’ve looked at the samples from Spring package and didn’t find any Exception handling in the domain or service area. The DataAccessException seems to be ignored after leaving dao area.

Please suggest a good design for this matter.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:35:49+00:00Added an answer on June 4, 2026 at 12:35 pm

    The DataAccessException seems to be ignored after leaving dao area.

    And that’s a good thing! Let it fly down through the whole stack. You probably have transactions on service layer – the exception will transparently cause the outermost transaction to be rolled-back. Great!

    Now it will find its way to the controller. If you catch it in the Struts controller, you can e.g. return different view. But most likely you don’t want to handle exception in each and every Struts action. So let the exception fly even further down. At some point Struts will catch that exception and try to handle it. Struts has some sophisticated error handling mechanisms, you’ll find plenty of information about them. Typically it will invoke some custom action or error screen depending on exception type.

    Finally, if even Struts can’t handle the exception, it will be rethrown to the container, causing HTTP 503 with exception details being returned.

    As you can see you can control exceptions on a lot of levels, typically lower is better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to develop an application using Spring 2.5.5 Flex/J2EE and Hibernate 3.1.3.
I want to develop a GAE application using python, but I fear that Google
says if i develop a Ruby on Rails application using Rails 2.3.2, will that
I have to develop an application using C#.net that has to be run once
I have develop android application using Android SDK, Eclipse IDE.In that some times showing
I develop java application using Spring 3.0.5 and I work with database Oracle using
when you develop a web application using ExtJS (with its MVC and a Viewport),
I'm starting to develop an application using MySQL and although I've developed apps before
I am trying to develop an application using ADO.NET. I have two tables in
I want to develop mysql database application using dbexpress to develop from scratch or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.