This week's book giveaway is in the Design and Architecture forum.
We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Why do 2.1.7 DAO Interfaces drop throws Exception?

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm implimenting my Torque DAO for 2.1.7 and have noticed that the most of the DAO interfaces drop the "throws exception" clause. And I can see that the existing DAO implimentations now wrap this with a DatabaseException.

I'm wondering what the logic was to make this change.

The problem I have with this is that the jForum error writer does not do a good job of writing traces back to the original root cause. E.g., Try finding the actual problem from an SQL Exception that is wrapped in a TorqueException that then gets wrapped in a DatabaseException. FWIW, I also know that the same kind of Exception wrapping can occure with some LDAP and ActiveDirectory access tools as well.

IMHO, if you are going to have a generic interface, you need to either do a good job of reporting root causes or allow the implimentors to throw their native exceptions. Also throwing a generic Exception should remind the core code writers to think about the fact that someone might be using an implimentation that they never thought about and add appropriate error checking/recovery code.

Anyway, any chance the DAO methods could be rolled back to include throws Exception again?

TIA

Greg


[originally posted on jforum.net by monroe]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, no change to include the throws Exception again. But we can try to fix ExceptionWriter / *Exception implementations, to handle the missing stack traces.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, that works.

I guess not too many folks have done DAO implimentions and the few who have will just have to rewrite to allow for the change in the 2.1.7 Interfaces.
[originally posted on jforum.net by monroe]
 
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic