I be way off, but at first glance, isn't wrapping things in a using statement going to ensure that the resources are closed? I'm not sure that's what you want to do. We always let iBatis manage the connections automatically. Of course, I haven't profiled to see what it actually does.
_____ From: Dorin Manoli [mailto:[EMAIL PROTECTED] Sent: Friday, May 04, 2007 5:44 AM To: [email protected] Subject: Sessions 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 screen. 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 called. I thought if I'll use Sessions I will save "precious" 13ms on each OpenConnection call. So I followecd example from iBATIS Maper manual. [C#] using ( IDalSession session = sqlMap.OpenConnection() ) { Account account = sqlMap.QueryForObject("GetAccountViaColumnName", 1) as Account; } 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. Cheers. 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. -------------------------------------------------------- Princeton Retirement Group, Inc - Important Terms This E-mail is not intended for distribution to, or use by, any person or entity in any location where such distribution or use would be contrary to law or regulation, or which would subject Princeton Retirement Group, Inc. or any affiliate to any registration requirement within such location. This E-mail may contain privileged or confidential information or may otherwise be protected by work product immunity or other legal rules. No confidentiality or privilege is waived or lost by any mistransmission. Access, copying or re-use of information by non-intended or non-authorized recipients is prohibited. If you are not an intended recipient of this E-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute any portion of this E-mail. The transmission and content of this E-mail cannot be guaranteed to be secure or error-free. Therefore, we cannot represent that the information in this E-mail is complete, accurate, uncorrupted, timely or free of viruses, and Princeton Retirement Group, Inc. cannot accept any liability for E-mails that have been altered in the course of delivery. Princeton Retirement Group, Inc. reserves the right to monitor, review and retain all electronic communications, including E-mail, traveling through its networks and systems (subject to and in accordance with local laws). If any of your details are incorrect or if you no longer wish to receive mailings such as this by E-mail please contact the sender by reply E-mail. --------------------------------------------------------

