Announcement Announcement Module
Collapse
No announcement yet.
Exceptions to be trown inside DAO Layer wen using Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exceptions to be trown inside DAO Layer wen using Spring

    Hi , i had difficult time understanding what kind of exceptions to be thrown inside the Spring DAO Layer .

    DataAccessException is a runtime exception .

    How can i handle ApplicationExceptions say (UserAlreadyExistsException ) should i throw this under the DataAccessException??

    Thanks in advance .

  • #2
    In Spring all exceptions are runtime. And, I think, it's a good feature. But runtime exceptions are handled in the same way as others, what have you problem with?

    Comment


    • #3
      Thanks ctapobep ,

      My query , will this be a Good approach ?

      catch(DataAccessException)
      {
      throw new UserAlreadyExistsException()
      }

      Comment


      • #4
        Yep, it's rather good approach.
        btw, there is embedded mechanism in Spring MVC of working with such exceptions. For more information you may look at Validator interface.

        Comment


        • #5
          Thank you very much .

          Comment

          Working...
          X