-->
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.  [ 3 posts ] 
Author Message
 Post subject: System.Transactions
PostPosted: Sun Mar 05, 2006 8:20 pm 
Newbie

Joined: Sun Jul 24, 2005 2:19 am
Posts: 7
Is it possible to use System.Transactions and wrap up NH transactions along with other resources e.g. MSMQ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 06, 2006 12:45 am 
Newbie

Joined: Wed Jan 25, 2006 10:53 pm
Posts: 9
I have tried, it did work but I was getting some cirmcumstances where it would not start a transaction.

So i have given up for the moment. If you can get it to work reliably I'd use it again.

Tim


Top
 Profile  
 
 Post subject: transactionscope usage
PostPosted: Fri Mar 10, 2006 5:49 am 
Newbie

Joined: Thu Nov 17, 2005 6:37 pm
Posts: 13
Hi,
This is an interesting one, as we are using NHibernate (SQL Server 2005) with the ASP.Net 2 Membership API, which is calling a different db. When we use transaction scope it works with NH, with the following provisos:

Make sure the first call with the TransactionScope to NH managed objects opens a new session. So, close your session when getting the transactionscope. We made a TransactionScopeWorker object which did this for us, ensuring we had a new session to play with at the start of every transaction. Makes good sense as well, flusing out any outstanding work.

Next, do all your calls. We had problems with just leaving the changes to objects and not explicitly calling a Save() (with flush) before the scope.Complete() call. For some reason the NH managed transaction does not get it's commit called automatically by the TransactionScope object.

So, as long as you start with a new session and explicitly flush after each unit of work (not necessary to close session) you can combine NH with other DB calls.

One last thing to note is that MS DTC may need to be installed on your SQL Server and Dev Boxes. The System.Transactions is based on some old COM+ Enterprise Services stuff that required us to use MSDTC to manage multiple db connections.

This sort of stuff is bound to get easier, took us a while to get this right.


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.