The id is a property of the mapper. Once yo do ISqlMapper sqlMapper = Mapper.Instance();
You get the id automagically. The other solution is given by Chen Jin, BUT the first option is extremelly bad in performance. The new instance of the mapper makes a re-configuration of the mapper with the XML files, so if you do X queries, you're just re-configuring X times the mapper (as far as I understand on my experience). Don't know about the second solution. Try with ISqlMapper sqlMapper = Mapper.Instance(); sqlMapper.SessionStore = new HybridWebThreadSessionStore(sqlMapper.Id); sqlMapper.TheiBatisMethods() instead of Instance().TheiBatisMethods() TheiBatisMethods() = Insert(), Delete(), Update(), QueryForList<T>(), etc. In our case, we used iBatis in web and inside a workflow managed by the workflowruntime (that runs in another thread), that's a very similar problem in the threaded execution. Greetings! On Wed, Aug 12, 2009 at 10:11 AM, jmsandy<jmsa...@gmail.com> wrote: > > > Hi friend, > > The problem is that I can not get the id. I have this attribute, as I do? > > Is there any way static. > > Thanks for the tip. > > > Juan Pablo Araya wrote: >> >> I had the same problem a year ago. The error occurred because you run >> ibatis in different threads. In my case, I just used >> >> ISqlMapper sqlMapper = Mapper.Instance(); >> sqlMapper.SessionStore = new >> HybridWebThreadSessionStore(sqlMapper.Id); >> >> in every iBatis call and then it worked. >> >> Hope this work for you. Greetings and sorry for my poor english! >> >> On Wed, Aug 12, 2009 at 9:45 AM, jmsandy<jmsa...@gmail.com> wrote: >>> >>> Hi, >>> >>> I need much help from you. I need to optimize a query and the only >>> possible >>> way and run parallel accesses. >>> >>> I am consulting divided into parts to run. >>> >>> The scenario I have is: >>> 1) I make the call to a Webservice which routines should be run. >>> 2) I did call and got error with Threads. >>> 3) I tried with asynchronous methods and got error. >>> 4) The error I am getting is: >>> >>> Message="WebSessionStore: Could not obtain reference to HttpContext" >>> Source="IBatisNet.DataMapper" >>> StackTrace: >>> at >>> IBatisNet.DataMapper.SessionStore.WebSessionStore.ObtainSessionContext() >>> at >>> IBatisNet.DataMapper.SessionStore.WebSessionStore.get_LocalSession() >>> at IBatisNet.DataMapper.SqlMapper.QueryForList[T](String >>> statementName, Object parameterObject) >>> >>> How do I make several simultaneous queries in Ibatis. Please pass me an >>> example. >>> >>> Thanks. >>> >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/Help-in-MultiThreads-tp24936820p24936820.html >>> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-cs-unsubscr...@ibatis.apache.org >>> For additional commands, e-mail: user-cs-h...@ibatis.apache.org >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-cs-unsubscr...@ibatis.apache.org >> For additional commands, e-mail: user-cs-h...@ibatis.apache.org >> >> >> > > -- > View this message in context: > http://www.nabble.com/Help-in-MultiThreads-tp24936820p24937420.html > Sent from the iBATIS - User - Cs mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-cs-unsubscr...@ibatis.apache.org > For additional commands, e-mail: user-cs-h...@ibatis.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-cs-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-cs-h...@ibatis.apache.org