reset member committed and rolledBack when start transaction sucessfully in AdoTransaction.Begin.

Description

I have reviewed AdoTransaction.cs . and I found, It is better that reset committed and rolledBack to false after start transaction successfully.
Because if we start a transaction and commit, then, we call session.BeginTransaction to start another transaction, but at this time, session.Transaciton.WasCommitted returns true.

So reset commited and rolledBack after successful to start transaction is necessary.
eg:

public void Begin()
{
log.Debug( "begin" );

try
{
IsolationLevel isolation = session.Factory.Isolation;
if( isolation == IsolationLevel.Unspecified )
{
trans = session.Connection.BeginTransaction();
}
else
{
trans = session.Connection.BeginTransaction( isolation );
}

committed = false;
rolledBack = false;
}
catch( Exception e )
{
log.Error( "Begin transaction failed", e );
throw new TransactionException( "Begin failed with SQL exception", e );
}

begun = true;
}

Environment

NHibernate beta-0.7 dotNet 1.1

Activity

Show:

Former user 
May 13, 2005 at 1:10 PM

I created a test and couldn't reproduce it in 0.8. It must have been fixed between 0.7 and 0.8.

Former user 
May 12, 2005 at 10:45 AM

Transactions shouldn't be reusable like this, ISession.BeginTransaction creates a new transaction. I'll create a test to check it.

Cannot Reproduce

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created March 29, 2005 at 6:23 AM
Updated May 13, 2005 at 1:10 PM
Resolved May 13, 2005 at 1:10 PM
Who's Looking?