The code looks correct. Can you post your configuration?

On Fri, Dec 3, 2010 at 3:59 PM, rodri_ogri <[email protected]> wrote:

> Hi Fabio,
> I followed your comment and I tried with both factories, but none of
> them works, unless I'm not assigning the correct way the factory
> (myConfiguration.SetProperty("transaction.factory_class",
> "NHibernate.Transaction.AdoNetWithDistributedTransactionFactory,
> NHibernate");) .
>
> regards
>
> On 3 dic, 12:13, Fabio Maulo <[email protected]> wrote:
> > Yes but it may depend on the transaction-factory he has configured.
> > NH has 2 transaction factories:
> > AdoNetWithDistributedTransactionFactory (default)
> > AdoNetTransactionFactory (was default in previous versions)
> >
> >
> >
> > On Fri, Dec 3, 2010 at 11:00 AM, Juan <[email protected]> wrote:
> > > I don't think it is related to Oracle. We've been using distributed
> > > transaction with NH and no issues. Part of your problem seems to be
> > > that you are trying to start up an ADO.NET/NH transaction inside the
> > > TransactionScope, this is not needed. Once in a transaction scope, NH
> > > is smart enough to pick this up, and every sql statement will be
> > > withing the distributed transaction. You will see some weird messages
> > > in the log, about a transaction present set to null or something like
> > > that, you can ignore those with an Oracle DB
> >
> > > On Dec 2, 5:18 pm, rodri_ogri <[email protected]> wrote:
> > > > I forgot to paste the message :P,
> >
> > > > "[NHibernate.TransactionException]{"Begin failed with SQL exception"}
> > > > The connection is already part of a local or distributed transaction"
> >
> > > > Is it a Oracle related issue?
> >
> > > > best regards
> >
> > > > On 2 dic, 12:31, Fabio Maulo <[email protected]> wrote:
> >
> > > > > A stack trace without the exception message is more than enough.
> > > > > Thanks.
> >
> > > > > On Thu, Dec 2, 2010 at 12:54 PM, rodri_ogri <[email protected]>
> > > wrote:
> > > > > > Hi all,
> >
> > > > > > I have tried something I thought was fixed on this version, it is
> the
> > > > > > capability to work with TransactionScope and NH transactions with
> an
> > > > > > Oracle 11G DB.
> >
> > > > > > This is the test I have done:
> >
> > > > > > [TestMethod]
> > > > > >        public void TransactionScope_Test()
> > > > > >        {
> > > > > >            bool vTransactionInitialized = false;
> >
> > > > > >            using(TransactionScope vTx = new
> > > > > > TransactionScope(TransactionScopeOption.Required))
> > > > > >            {
> > > > > >                using (ISession vSession =
> > > > > > SessionFactory.OpenSession())
> > > > > >                {
> > > > > >                    using(ITransaction vNHTransaction =
> > > > > > vSession.BeginTransaction())
> > > > > >                    {
> > > > > >                        try
> > > > > >                            {
> > > > > >                            vTransactionInitialized = true;
> > > > > >                            vNHTransaction.Commit();
> > > > > >                            }
> > > > > >                            catch (Exception)
> > > > > >                            {
> > > > > >                            vNHTransaction.Rollback();
> > > > > >                            }
> > > > > >                    }
> > > > > >                }
> > > > > >                vTx.Complete();
> > > > > >            }
> >
> > > > > >            Assert.IsTrue(vTransactionInitialized);
> > > > > >        }
> >
> > > > > > It throws a NHibernate.TransactionException with the following
> trace:
> >
> > >
> Oracle.DataAccess.Client.OracleConnection.BeginTransaction(IsolationLevel
> > > > > > isolationLevel)
> >
> > >
> Oracle.DataAccess.Client.OracleConnection.BeginDbTransaction(IsolationLevel
> > > > > > isolationLevel)
> >
> > >
> System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransaction()
> > > > > > NHibernate.Transaction.AdoTransaction.Begin(IsolationLevel
> > > > > > isolationLevel) in
> d:\CSharp\NH\nhibernate\src\NHibernate\Transaction
> > > > > > \AdoTransaction.cs: line 130
> > > > > > NHibernate.Transaction.AdoTransaction.Begin(IsolationLevel
> > > > > > isolationLevel) in
> d:\CSharp\NH\nhibernate\src\NHibernate\Transaction
> > > > > > \AdoTransaction.cs: line 145
> > > > > > NHibernate.Transaction.AdoTransaction.Begin() in d:\CSharp\NH
> > > > > > \nhibernate\src\NHibernate\Transaction\AdoTransaction.cs: line 94
> > > > > > NHibernate.AdoNet.ConnectionManager.BeginTransaction() in
> > > d:\CSharp\NH
> > > > > > \nhibernate\src\NHibernate\AdoNet\ConnectionManager.cs: line 324
> > > > > > NHibernate.Impl.SessionImpl.BeginTransaction() in d:\CSharp\NH
> > > > > > \nhibernate\src\NHibernate\Impl\SessionImpl.cs: line 1437
> >
> > > > > > Is it possible to have it fixed on this new version?
> >
> > > > > > best regards
> >
> > > > > > Rodrigo
> >
> > > > > > --
> > > > > > 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]<nhusers%[email protected]>
> <nhusers%[email protected]<nhusers%[email protected]>
> >
> > > <nhusers%[email protected]<nhusers%[email protected]>
> <nhusers%[email protected]<nhusers%[email protected]>
> >
> >
> > > > > > .
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/nhusers?hl=en.
> >
> > > > > --
> > > > > Fabio Maulo
> >
> > > --
> > > 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]<nhusers%[email protected]>
> <nhusers%[email protected]<nhusers%[email protected]>
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/nhusers?hl=en.
> >
> > --
> > Fabio Maulo
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
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