Joined: Wed Apr 26, 2006 3:18 pm Posts: 8
|
I am attempting to create an Interceptor in order to do some auditing (similar to the example shown in 'Hibernate in Action'.
I have statement similar to this:
ISession auditSession = NHibUtil.SessionFactory.OpenSession(session.Connection);
Where session is the main outer session which I pass in when instantiating the interceptor. I am using SQL Server.
However, when I come to use the auditSession (such as auditSession.Save(anObject) for example). I get the following exception:
System.InvalidOperationException: ExecuteReader requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized.
I suspect this is because the auditSession does not have a reference to the outer sessions transaction.
What am I doing wrong? Has anybody got a solution to this problem?
Thanks in advance ......
|
|