The following code snippet works fine with SQL Server 2008 (SP1) but
with Oracle 11g the call to session.BeginTransaction() throws an
exception with the message  ‘Connection is already part of a local or
a distributed transaction’ (stack trace shown below). Using the
'"NHibernate.Driver.OracleDataClientDriver".

Has anyone else run into this?

using (var scope = new TransactionScope())
{
   using (var session = sessionFactory.OpenSession())
   using (var transaction = session.BeginTransaction())
   {
      // do what you need to do with the session
      transaction.Commit();
    }
    scope.Complete();
}


Exception at:    at
NHibernate.Transaction.AdoTransaction.Begin(IsolationLevel
isolationLevel)
   at NHibernate.Transaction.AdoTransaction.Begin()
   at NHibernate.AdoNet.ConnectionManager.BeginTransaction()
   at NHibernate.Impl.SessionImpl.BeginTransaction()
   at
MetraTech.BusinessEntity.DataAccess.Persistence.StandardRepository.SaveInstances(List`1&
dataObjects) in S:\MetraTech\BusinessEntity\DataAccess\Persistence
\StandardRepository.cs:line 3103

Inner error message was: Connection is already part of a local or a
distributed transaction
Inner exception at:    at
Oracle.DataAccess.Client.OracleConnection.BeginTransaction(IsolationLevel
isolationLevel)
   at
Oracle.DataAccess.Client.OracleConnection.BeginDbTransaction(IsolationLevel
isolationLevel)
   at
System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransaction()
   at NHibernate.Transaction.AdoTransaction.Begin(IsolationLevel
isolationLevel)

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to