Rodrigo, Try add "enlist=dynamic" in Oracle connection string to explictly specify the application enlists in distributed transaction. If you do not need distributed transaction, set to the AdoNetTransactionFactory. I use fluent nhibernate to config it. cfg.SetProperty(NHibernate.Cfg.Environment.TransactionStrategy, typeof(NHibernate.Transaction.AdoNetTransactionFactory).FullName)
Regards, Tao On Dec 6 2010, 8:19 am, rodri_ogri <[email protected]> wrote: > Hi Jason, > > Appologies for the delay, > > Here's my configuration: > > <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> > <session-factory> > <property > name="connection.provider">NHibernate.Connection.DriverConnectionProvider</ > property> > <property name="dialect">NHibernate.Dialect.Oracle10gDialect</ > property> > <property > name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</ > property> > <property > name="connection.connection_string_name">ConnectionString.Oracle > (ODP.NET)</property> > <property > name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, > NHibernate.ByteCode.LinFu</property> > <property name="show_sql">false</property> > <property name="query.substitutions">true=1;false=0</property> > <mapping assembly="MyEnterprise.Model" /> > </session-factory> > </hibernate-configuration> > > I'm using the ODP assembly (Oracle.DataAccess) version: 2.11.2.1.0 > > Best regards > Rodrigo > > On 4 dic, 22:00, Juan <[email protected]> wrote: > > > > > Connection leaking happened in my case(wcf environment), when a > > unhanlded exception was thrown and the session never got disposed. > > I've not seen any other side effects, besides that you need to > > configure the connection release mode to on_close since distributed > > transaction can commit on a different thread, and you must make sure > > the session is still available. If you read the comments on davy's > > blog post, you will find the pattern I use. > > > Like Fabio said, the distributed txn factory is used by default, so no > > configuration changes shoul be needed. My recommendation is that you > > check the version of odp.net you are running, and check the connection > > string documentation for oracle since I think there is a Parm that > > might need to be turned on. With dist. Txn, if you want to rollback, > > either throw an exception or call thetransactionscope.dispose(). Also > > cover all your bases, check that meets is running and check the > > statistics to make sure txns are being generated > > > On Dec 3, 3:30 pm, rodri_ogri <[email protected]> wrote: > > > > B.T.W, I have previously saw an issue regarding to leaking connections > > > on this > > > site:http://davybrion.com/blog/2010/05/avoiding-leaking-connections-with-n... > > > > The autor states that is order to avoid the leak when using > > >transactionScope(which is my case) thetransactionscopeinstance > > > should be surrounding a NH Transaction, otherwise it will consume the > > > connection pool. Now, I'm not sure if that recomendation is the best > > > practice, but I find it interesting to comment if that brings any > > > solution to this issue, > > > > best regards. > > > > Rodrigo > > > > On 3 dic, 10:00, 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 withTransactionScopeand NH transactions with an > > > > > > > Oracle 11G DB. > > > > > > > > This is the test I have done: > > > > > > > > [TestMethod] > > > > > > > public void TransactionScope_Test() > > > > > > > { > > > > > > > bool vTransactionInitialized = false; > > > > > > > > using(TransactionScopevTx = 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] > > > > > > > > > > > > > > > . > > > > > > > For more options, visit this group at > > > > > > >http://groups.google.com/group/nhusers?hl=en. > > > > > > > -- > > > > > > Fabio Maulo- Hide quoted text - > > - Show quoted text - -- 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.
