ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Baldur Norddahl <...@inaphone.com>
Subject Re: session leak in ibatis 2.0.8
Date Tue, 28 Dec 2004 16:15:06 GMT
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.


View raw message