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: Nested transactions
PostPosted: Tue Dec 01, 2009 10:41 am 
Newbie

Joined: Mon Nov 02, 2009 9:52 am
Posts: 19
Does Nhibernate support nested transactions?


Top
 Profile  
 
 Post subject: Re: Nested transactions
PostPosted: Wed Dec 02, 2009 9:50 am 
Newbie

Joined: Mon Nov 02, 2009 9:52 am
Posts: 19
In the following example t is also commited if I call t1.Commit(). A consequence is that I get an exception if I call t.Commit() later. I do not want t to be commited as I call t1. Commit(). Can someone give me the right direction?

Code:
using (ITransaction t = session.BeginTransaction())
            {
                using (ITransaction t1 = session.BeginTransaction())
                {
                    Node Node99= (Node)session.Load(typeof(Node), 99);
                    Node99._name = "Node 99";
                    session.Save(Node99);
                    t1.Commit();
                }

                Node Node98= (Node)session.Load(typeof(Node), 98);
                Node98._name = "Node98";
                session.Save(Node98);
                t.Commit();
            }


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.