ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dorin Manoli" <Dorin.Man...@dataireland.ie>
Subject Sessions
Date Fri, 04 May 2007 09:44:06 GMT
Hi everybody.

I got a little trouble with connections.


First I will start with a brief description of my Application.


I got a Class Library which includes iBATIS XML files, persistent
classes. Also in this Library is a static class Mapper which create and
configure DomSqlMap and through which I can cal lISqlMapper..

I followed example from iBATIS document. 

Then I assigned a MAP class to each persistent class.

Ex. I have Customer class then I create another class CustomerMap which
contains methods for operations like Add/Update/Delete.


I have couple of  such class-combination. Finaly I have a WinForm
application from which I call MAP classes and render information on


Finally    the problem:

I used JetBrains dotTrace profiler to optimize my code and I found that
each time I call a method from MAP class iBATIS OpenConnection method is

I thought if I'll use Sessions I will save "precious" 13ms on each
OpenConnection call. So I followecd example from iBATIS Maper manual.



using ( IDalSession session = sqlMap.OpenConnection() )


Account account = sqlMap.QueryForObject("GetAccountViaColumnName", 1) as



But instead of calling sqlMap.QueryObject

I am using 


using ( IDalSession session = Mapper.Instance().OpenConnection() )


       Customer cust=customerMap.GetCustomer(customerId);

       ....... . . . .



Inside GetCustomer I have


Mapper.Instance().QueryForObject(... . . );



Profiling again I saw that OpenConnection is invoked again.

Something went wrong, but couldn't find in any manual how to properly
use Session. Also looking in unit tests Ididn't found answers.




Precision Marketing Information Limited, trading as Data Ireland, registered in Ireland, registered
number 224335, Registered Office: General Post Office, O'Connell Street, Dublin 1. 

Kompass Ireland Publishers Limited, registered in Ireland, registered number 98432, Registered
Office: General Post Office, O'Connell Street, Dublin 1.

View raw message