When you use OpenSessionInView module in a web application and use HibernateTransactionManager, you get "NullReferenceException" in response to a AdoException at "HibernateTransactionManager.ConvertAdoAccessException" method. The code i tried is as follows:
This is the dao method,
[Transaction(ReadOnly = false)]
public void Save(Product product)
I have copied the configuration from the Spring.Data.NHibernate.Northwind project in examples folder.
I checked the source files and I think that, because there is an existing transaction HibernateTemplate does not flush the session. So the exception is not thrown from HibernateTemplate. At the end of the transaction, HibernateTransactionManager tries to commit the transaction and NullReferenceException occurs because "adoExceptionTranslator" field of the transaction manager is null. The documentation does not tell about how to set an AdoExceptionTranslator to this field. I think the main problem is that, if you use HibernateTransactionManager, HibernateTemplate's error handling becomes useless.
I changed the getter of "AdoExceptionTranslator" in "HibernateTransactionManager" as the following,
public IAdoExceptionTranslator AdoExceptionTranslator
if (adoExceptionTranslator == null)
which i copied from HibernateTemplate. Now the AdoException is being converted.