want to have something like sub-transactions, in that you can mark a point where you would start the sub-transaction, then at the point of descision for that bit, you can either roll-back (abort the sub-bit) or carry on, effectively commiting, when the out transation commits. Of course, if you abort the outer transaction, the marked bit aborts too.
How can I do that with NHibernate.I have the following code but it seems that the Transaction is set to null after thye first commit and hence i`m having the error message that
Quote:
no open transaction to commit
.
My code is as follows:
Code:
API.Data.Session session = API.Data.SessionManager.GetSession();
session.BeginTransaction();
try
{
Project project = Project.Load(ID);
...........
Save(project);
.....................
session.CommitTransaction();
}
catch
{
session.RollbackTransaction();
throw;
}
Code:
public void save(Project project)
{
Data.SessionManager.GetSession().BeginTransaction();
try
{
Save();
LogIssueChange(test);
Data.SessionManager.GetSession().CommitTransaction();
}
catch
{
Data.SessionManager.GetSession().RollbackTransaction();
throw;
}
}