Hi all,
Im´trying to use TransactionScope, but in some cases the rollback doesn´t work.
For example: I insert the obj1 correctely, but when try insert obj2 occurs an normally error
defined by myself, BUT the obj1 was already inserted to database and it doesn´t roll back.
This occurs and on TO, but and other not occurs.
Code:
using (TransactionScope scope = NHibernateUtil.GetNewScope(TransactionScopeOption.Required))
{
FamilyTO familyTO = new FamilyTO();
try
{
otherBO.insert(obj1);// It has transaction scope too...
thisDAO.insert(obj2);
NHibernateUtil.CommitTransaction();
}
catch (Exception exception)
{
NHibernateUtil.RollbackTransaction();
throw new BusinessException(null, "generic.error", "FamilyBOImpl.Insert()", exception, familyTO);
}
finally
{
NHibernateUtil.CloseSession();
scope.Complete();
}
}
Somebody can help me?
thanks!!!!