Beginner |
 |
Joined: Fri Aug 10, 2007 3:34 am Posts: 44
|
in my project there are 2 sessionfactory's: one for 'normal' objects
and one for versions (the versions are stored in separate tables,
hence the 2 sessionfactory's)
i want to be able to span a transactions on 2 sessions,each from a different
sessionfactory like this
ISession session = Helper.GetSessionFact().OpenSession();
ITransaction transOne = session.BeginTransaction()
do some saving
transOne.Commit();
ISession sessionVer = Helper.GetVersionSessionFact().OpenSession();
ITransaction transVer = sessionVer.BeginTransaction()
do some saving
transVer.Commit();
i'm treating exceptions in a try catch block for every transaction.
there is a problem:
suppose the first transaction commits successfully:
if the second transaction fails i want to call transOne.Rollback()
but that throws an exception since transOne.IsActive is false due to
the call of transOne.Commit()
why can't i rollback the transaction after commit?
or better yet: what shoul i do to be able to rollback the transaction?
does it have anything to do with the fact that the transactions
origin from different sessionfactory's?
|
|