-->
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: Issue with the Committing transaction
PostPosted: Thu Jul 17, 2008 9:24 am 
Newbie

Joined: Tue Jul 15, 2008 3:55 pm
Posts: 5
Am new to nHibernate.I have some problem after commiting the data to database.
If you see the follwing code after "Step 2" the control is going to "Step 4" then exiting the mehtod with out going to "Step 3".Practically it should go to "Step 3" after "Step 4" then it should exit the method.
I could not able to understand what is happening behind the scenes.
Note:My updates were successfull and they written to DaataBase
could some one help me..

_session = _sessionFactory.OpenSession();
ITransaction txBridgeInfo = null;

try
{
txBridgeInfo = _session.BeginTransaction();

_session.SaveOrUpdate(item); --->Step 1
txBridgeInfo.Commit(); --->Step 2
} --->Step 3
catch (Exception ex)
{
if (txBridgeInfo != null)
txBridgeInfo.Rollback();

throw ex;
}
finally
{
_session.Close(); --->Step 4 }
}


Last edited by don_don on Wed Jul 23, 2008 10:07 am, edited 3 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 21, 2008 1:29 am 
Beginner
Beginner

Joined: Thu Nov 29, 2007 4:36 am
Posts: 20
In c#, the finally block gets executed immediately after the try block. Or if an exception occures , the finally block is executed then the catch block.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 21, 2008 8:47 am 
Newbie

Joined: Tue Jul 15, 2008 3:55 pm
Posts: 5
I did not see any errors or exceptions occured and my transaction was completed succesfully.

I have created a sample application where it goes to step 3 after step 2 then step 4.


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