Hi All.

I have several components, which use ISessionManager.
Typical component method is:
using (ISession s = sessMgr.OpenSession())
using (ITransaction tx = s.BeginTransaction())
{
    //save something here...
    tx.Commit();
}

But some component methods call other component methods, so i need a kind of
transaction stack behavior:
public void Outer()
{
    using (ISession s = sessMgr.OpenSession())
    using (ITransaction tx = s.BeginTransaction())
    {
        //save something here...
        Inner();
        tx.Commit();
     }
}

public void Inner()
{
    using (ISession s = sessMgr.OpenSession())
    using (ITransaction tx = s.BeginTransaction())
    {
       //save something here...
        tx.Commit();
    }
}

Inner's BeginTransaction() call returns existing transaction, its ok, but
Inner's Commit() call commits it, so the Outer's Commit() raises exception.
ISessionManager supports nested ISession's, as described here
http://castleproject.org/container/facilities/trunk/nhibernate/usingit.html#SessManager.

Is there a way to use with nested transactions?

-- 
Best regards,
Andrew Melnichuk

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to