QueryForMap(string statementName, object parameterObject, string keyProperty, string valueProperty) not calling session.CloseConnection() correctly ---------------------------------------------------------------------------------------------------------------------------------------------------
Key: IBATISNET-60 URL: http://issues.apache.org/jira/browse/IBATISNET-60 Project: iBatis for .NET Type: Bug Reporter: Ron Grabowski Assigned to: Gilles Bayon As of 5/9/2005, the version of IBatisNet.DataMapper.SqlMapper.cs in source control contains the following code: public IDictionary QueryForMap(string statementName, object parameterObject, string keyProperty, string valueProperty) { bool isSessionLocal = false; IDalSession session = _sessionContainer.LocalSession; IDictionary map = null; if (session == null) { session = new SqlMapSession(this.DataSource); session.OpenConnection(); isSessionLocal = true; } IMappedStatement statement = GetMappedStatement(statementName); try { map = statement.ExecuteQueryForMap(session, parameterObject, keyProperty, valueProperty); } catch { throw; } finally { if ( isSessionLocal ) { session.CloseConnection(); } } If ExecuteQueryForMap completes successfully and isSessionLocal is set to true, session.CloseConnection() is not called. The code should be changed as follows (to match the other QueryFor... methods): try { map = statement.ExecuteQueryForMap(session, parameterObject, keyProperty, valueProperty); } catch { throw; } finally { if ( isSessionLocal ) { session.CloseConnection(); } } -- 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