[ 
http://issues.apache.org/jira/browse/IBATISNET-104?page=comments#action_12360227
 ] 

Ron Grabowski commented on IBATISNET-104:
-----------------------------------------

CachingStatement's ExecuteQueryForObject method uses this code to generate the 
appropriate CacheKey to check the cache:

 object obj = null; 
 RequestScope request = this.Statement.Sql.GetRequestScope(
 parameterObject, session);
 _mappedStatement.PreparedCommand.Create(
 request, session, this.Statement, parameterObject);
 Cache.CacheKey cacheKey = this.GetCacheKey(request);
 cacheKey.Update("ExecuteQueryForObject");
 obj = this.Statement.CacheModel[cacheKey];

The current implementation of Create() uses the session and an IDbCommand to 
construct the list of  IDataParameters for the IDbCommand. Perhaps we could 
change the code in ApplyParameterMap to generate the IDbParameterCollection 
without requing an IDbCommand or IDbConnection. If we encounter a cache miss, 
an IDbCommand and IDbConnection would be created and the already calculated 
IDbParameterCollection would then be attached to the IDbCommand.

> QueryForXXX do not check cache before opening/closing connection
> ----------------------------------------------------------------
>
>          Key: IBATISNET-104
>          URL: http://issues.apache.org/jira/browse/IBATISNET-104
>      Project: iBatis for .NET
>         Type: Wish
>   Components: DataMapper
>     Versions: DataMapper 1.2.1
>     Reporter: H. E. Sum
>     Priority: Minor

>
> I was confused by SqlMapper opening and closing database connections even 
> when items were cached. I thought that it was fetching results from the 
> database, but when I looked at the source, it seemed like the QueryForXXX 
> methods are opening connections, calling MappedStatement to fetch results and 
> then closing connections. Perhaps opening/closing should be pushed to the 
> MappedStatement Class so connections are used only when there's a cache miss.

-- 
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

Reply via email to