1

Closed

Add exception translation advice after dropping use of NHibernateTemplate

description

From Mark Pollack: Not using HibernateTemplate means you don't get the translation of NHibernate exceptions to Spring's Data Access Exception hierarchy. You can though add this functionality using AOP. The advice is fairly simple to implement though to be on par with what is offered in Java (additional ease of use) it would require a fair bit of extra busy work at this point. Nevertheless, the basic calling code could be cut-n-pasted out of the catch blocks in HibernateTemplate's
 
'public object Execute(IHibernateCallback action, bool exposeNativeSession)' method. It can be done by implementing an IMethodInterceptor. Spring.Java's PersistenceExceptionTranslationInterceptor shows the basic idiom.
Closed Jul 11, 2008 at 10:44 PM by wmccafferty
This is no longer applicable as Spring.NET is no longer included in 0.7.0.

comments