PDA

View Full Version : How to work with IAdoExceptionTranslator?


beatles1692
08-30-2006, 07:22 AM
Hi
First,I should say that I'm really impressed by nhibernate integration.
Thank you.
I wrote a small test application framework using nhibernate integration.
it's working fine.But when an exception is thrown , instead of getting that exception I get a Null Reference exception (as far as I realized that's because there's no ado exception translator attached to my HibernateTemplate)
Then I have two questions to ask:
A)Is there any default adoExceptionTranslator that I can use?Or should I write my own ( I mean is there any translator that performs no translation at all and gives me the original exception ?)
B)What are the best practices for implementing exception handling ?

Mark Pollack
11-26-2006, 04:14 AM
Hi,

Sorry for the late reply... Yes, there is an implementation of IAdoExceptionTranslator. Maybe there wasn't at the time you were using the code. Just get the latest download (http://www.springframework.net/downloads/Spring.Data.NHibernate/). There is also NH 1.2 beta support in cvs.

As for best practices with exception handling....that is a big topic, but with respect to you data access layer, the motivations behind a 'generic' DAO exception hierarchy and not one baesd on specific vendor exceptions or error codes is a best practice. You can read more about that in the docs (http://www.springframework.net/doc-latest/reference/html/dao.html).

Mark