Hi,
I have the following code all over many files in my data acces layer. The
problem, the user calls the Save or SaveOrUpdate calls, then Commit for
several different tables. If an exception is thrown after a few successful
save transaction, only a partial save is successful and the exception will
halt save transaction from saving the rest of the tables.
Question: If the code is written like the following, If there is an
exception thrown after a few save & commit, How to Rollback on successful
Save transactions when a error occurred on the 3rd table save?
Thanks and greatly appreciate
ISession session = NHibernateSessionManager.GetCurrentSession();
using (ITransaction tx = session.BeginTransaction())
{
try
{
session.Save(prn);
tx.Commit();
}
catch (Exception)
{
tx.Rollback()
throw;
}
}
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.