-->
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.  [ 5 posts ] 
Author Message
 Post subject: ITransaction problem
PostPosted: Thu Aug 09, 2007 5:38 am 
Newbie

Joined: Tue Aug 07, 2007 5:33 pm
Posts: 4
Location: Stockholm
Does ITransaction support nesting transactions, or maybe it's called managed transactions. I mean where only the outermost transaction commits if all the inner ones have flagged commit.

I thought it would, but trying this:

Code:
ITransaction tx1, tx2;

tx1 = s.BeginTransaction();
tx2 = s.BeginTransaction();

s.Save(new Whatever());

tx2.Commit();
tx1.Rollback();


tx2 will commit the save and tx1.Rollback throw a DisposedException. I'm on .net1.1 and have made no special configurations on the ado side.

I've actually tried for a couple of hours now to find any info on this but with no definitive success.

_________________
/Andreas Karlsson


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 09, 2007 7:48 am 
Regular
Regular

Joined: Thu Nov 23, 2006 10:29 am
Posts: 106
Location: Belgium
Hi,

No, I checked the code and NHibernate does not support nested transactions.

Given the fact that SQLServer and Oracle do not support nested transactions in the true sense of the word (they support named transactions though), some other DBMS's do, and other DBMS's don't, I think a database-independent ORM like NHibernate should not support nested transactions anyway.

_________________
Please rate this post if it helped.

X.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 09, 2007 8:25 am 
Newbie

Joined: Tue Aug 07, 2007 5:33 pm
Posts: 4
Location: Stockholm
Well ok, I understand (n)hibernate can't guarantee support for truly nested transactions. But what about managed transactions or whatever they're called.

"Hibernate in action" states that an ITransaction only commits if it is the outermost transaction i.e the owner of the true transaction. Wasn't this behavior carried over to NHibernate?

I'm sure there's a standard solution to this in the NHibernate world, but I have real trouble finding any concrete information about it.

So can you get this functionality from NHibernate or from ADO or do you have to build it your self? Which i by the way already have done but doesn't really trust ;)

_________________
/Andreas Karlsson


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 09, 2007 7:03 pm 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
I believe you can use NHibernate with TransactionScope.

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 10, 2007 7:40 am 
Newbie

Joined: Tue Aug 07, 2007 5:33 pm
Posts: 4
Location: Stockholm
But that's .net2.0 isn't it? I'm tied to 1.1. I'll have a look at that for my next project.

As for my current problem I've tested and started to use my own NestedTransactionManager, I'm using an ISession delegate that returns these "managed" transactions so it's transparent to the client, works nice.

_________________
/Andreas Karlsson


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.