ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: session leak in ibatis 2.0.8
Date Mon, 03 Jan 2005 15:39:21 GMT
Thanks for the clarification Baldur.  I'll try to clarify that in the docs.

Cheers,
Clinton


On Mon, 03 Jan 2005 13:16:42 +0100, Baldur Norddahl
<bbn-ibatis@inaphone.com> wrote:
>  Sorry about that mail - it got delayed by the apache moderators because I
> accidently sent it with a different email address than the one I am
> subscribed with.
>  
>  It is identical to one you already answered, and the conclusion is that my
> code expected commitTransaction() to implicit call endTransaction() like in
> ibatis 1. IMHO this is an easy mistake to make since I associate those two
> calls with the SQL commands commit and rollback.
>  
>  Actually, altough the documentation says I always have to call
> endTransaction() it also says "The only way to return a connection to the
> DataSource (or close the connection) is to call commitTransaction() or
> endTransaction()" (page 39 in the iBATIS SQL Maps 2 Developer Guide -
> iBATIS-SqlMaps-4.pdf). This is not true, commitTransaction() does not close
> the resources, which was my problem.
>  
>  Baldur
> 
>  
>  Clinton Begin wrote: 
>  Sorry, I cannot recreate this behaviour. iBATIS certainly DOES close all
> resources, including the session. I've verified this in response to your
> report. The code you posted from the 1.x to 2.x conversion is clearly
> incorrect, so you know what to do with that. Otherwise, I cannot recreate
> the problem you describe. Clinton On Tue, 28 Dec 2004 17:15:06 +0100, Baldur
> Norddahl <bbn@inaphone.com> wrote: 
>  Clinton Begin wrote: endTransaction after every query. YES! It is by design
> that you have to GUARANTEE to call endTransaction() if startTransaction() is
> called. So make sure to call it in a finally block. Here's the example from
> the docs (again): startTransaction() was never called. You have to call
> endTransaction() anyway because ibatis forgets to close the session and
> return the db connection to the pool. try { sqlMap.startTransaction (); //
> .... do work sqlMap.commitTransaction (); } finally { sqlMap.endTransaction
> (); } Or, if you just call one of the work methods (queryForX, insert,
> update, delete etc.), then iBATIS does this for you (i.e. you don't call
> startTransaction()). No, that is what I am trying to say. iBatis does NOT
> call endTransaction() when you work without startTransaction(). It only
> commits your work, but forgets to release the resource. Baldur 
>

Mime
View raw message