ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Sorensen (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Created: (IBATISNET-201) Starting transaction after open connection
Date Wed, 27 Dec 2006 20:54:20 GMT
Starting transaction after open connection

                 Key: IBATISNET-201
                 URL: http://issues.apache.org/jira/browse/IBATISNET-201
             Project: iBatis for .NET
          Issue Type: Bug
          Components: DataMapper
    Affects Versions: DataMapper 1.5.1
         Environment: Windows XP SP2, SQLEXPRESS
            Reporter: Bill Sorensen
            Priority: Minor

I'm running into problems with disposing of a session.  I'd like to keep a connection open
for an extended period, and occasionally run transactions in it.  If I write my code as follows:
using (IDalSession session = Mapper.Instance().OpenConnection())
  // do stuff

The code blows up when the using block ends:

System.InvalidOperationException: This SqlTransaction has completed; it is no longer usable.
   at System.Data.SqlClient.SqlTransaction.ZombieCheck()
   at System.Data.SqlClient.SqlTransaction.Rollback()
   at IBatisNet.DataMapper.SqlMapSession.RollBackTransaction()
   at IBatisNet.DataMapper.SqlMapper.RollBackTransaction()
   at IBatisNet.DataMapper.SqlMapSession.Dispose()

This is a simplified example - the final code would have try..catch and multiple transactions
over time (not nested).

My workaround is to call OpenConnection() and CloseConnection() explicitly, and avoid the
using block.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message