-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Nhibernate + Oracle + TransactionScope
PostPosted: Wed Nov 02, 2011 10:06 am 
Newbie

Joined: Wed Nov 02, 2011 9:54 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.