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.  [ 2 posts ] 
Author Message
 Post subject: BeginTransaction has no effect (MSSQL)
PostPosted: Sun Apr 08, 2007 4:19 am 
Newbie

Joined: Sun Apr 08, 2007 3:50 am
Posts: 1
Hi

If I execute the following code snippets and trace the db queries with SQL Server Profiler, both snippets produce the same query: Only one insert query. But nothing about any transactional behaviour. If I run two (longer running) concurrent transactions, they aren't executed as atomic blocks.

Here are the code snippets - one with and one without transaction:

Code:
ISession session = NHibernateSessionFactory.CreateSession();
ITransaction tx = session.BeginTransaction();
Artikel a = new Artikel();
a.Bezeichnung = "new";
session.Save(a);
tx.Commit();
session.Close();


Code:
ISession session = NHibernateSessionFactory.CreateSession();
Artikel a = new Artikel();
a.Bezeichnung = "new";
session.Save(a);
session.Close();


(NHibernateSessionFactory configures the ISessionFactory in its static constructor and returns an OpenSession() when you call NHibernateSessionFactory.CreateSession())

I'm using MS SQL Server 2005 and NHibernate V1.0.3. The default isolation level is set to Serializable in ISessionFactory config. Any ideas why transactions don't work?

Thanks, Domi


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 08, 2007 8:44 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Not sure what this has to do with NHibernate, but anyway... What kind of behavior do you expect? Why do you say these transactions are not executed as atomic blocks? Does an error occur?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.