You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Gilles Bayon (JIRA)" <ib...@incubator.apache.org> on 2005/05/09 19:44:06 UTC
[jira] Closed: (IBATISNET-60) QueryForMap(string statementName, object parameterObject, string keyProperty, string valueProperty) not calling session.CloseConnection() correctly
[ http://issues.apache.org/jira/browse/IBATISNET-60?page=all ]
Gilles Bayon closed IBATISNET-60:
---------------------------------
Resolution: Fixed
Fix Version: DataMapper 1.2
Thanks Ron
> 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
> Assignee: Gilles Bayon
> Fix For: DataMapper 1.2
>
> 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