Hi, I have som difficulties implementing transactions with NHibernate to the Oracle DB on .Net 4 platform. I want to use System.Transactions.TransactionScope on my business logic layer for more database operations defined in data access layer. The problem is, that if an exception occurs, or there is a business condition that should invoke rollback, no rollback is invoked. All the successful DB operations are in DB commited.
Iam using something like this:
using(var transactionScope = new new System.Transactions.TransactionScope(TransactionScopeOption.Required, new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted }, EnterpriseServicesInteropOption.Full)) for (int i = 0; i < 2; i++) { using (var session = NHibernateHelper.OpenSession()) { //call DB logic } }
If there is an exception on the second call, the first one does not Rollback. I need to use new session every time i call DB. The most annoying thing is that this solution works fine with MSSQL Server.
I am using: Hibernate settings: <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"> //conn string </property> <property name="show_sql"> true </property> <property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property> </session-factory> </hibernate-configuration> Client/Server is running on .Net 4 platform
Your help will be appreciated, i spend hours trying to make this work
Ferdo
|