ok thanks.

iBatis SqlMapClient javadoc is not consistent regarding to session
management.
in SqlMapClient javadoc class part session is closed but in
SqlMapClient.openSession(Connection) javadoc the session is never closed. 

peace

Joe
 

---- Messages d´origine ----
De: Brandon Goodin <[EMAIL PROTECTED]>
Date: jeudi, février 9, 2006 5:38 pm
Objet: Re: Managing session opened with external connection

> When using openSession(...) you must also closeSession(). If you look
> at the SqlMapClient javadoc you will see information regarding
> openSession(). 
>
http://svn.apache.org/repos/asf/ibatis/trunk/java/mapper/mapper2/src/com/ibatis/sqlmap/client/SqlMapClient.java
> Brandon
> 
> On 2/9/06, Joel Costigliola <[EMAIL PROTECTED]> wrote:
> >
> > Thanks Brandon !
> >
> > Do you think it's important to close the session even if 
> connection is
> > managed externally ?
> >
> > ---- Messages d´origine ----
> > De: Brandon Goodin <[EMAIL PROTECTED]>
> > Date: jeudi, février 9, 2006 4:24 pm
> > Objet: Re: Managing session opened with external connection
> >
> > > If you are handling your connections externally, it is your job to
> > > clean them up.
> > >
> > > On 2/9/06, Joel Costigliola <[EMAIL PROTECTED]> wrote:
> > > >
> > > > After some code investigation, I think that connection 
> injected into
> > > > session - with openSession(myConnection) - are not released when
> > > session> is closed.
> > > >
> > > > Can anyone confirm that ? it's quite important for me to be sure
> > > of that
> > > > point to convince people at my work to use iBatis.
> > > >
> > > > I think closing the session is important but it is still not
> > > clear what
> > > > is done when session is closed.
> > > > Where can I have some explanation about session closing 
> mecanism ?
> > > >
> > > > Thanks for your help
> > > >
> > > > Joe
> > > >
> > > > ---- Messages d´origine ----
> > > > De: Joel Costigliola <[EMAIL PROTECTED]>
> > > > Date: mercredi, février 8, 2006 11:26 am
> > > > Objet: Managing session opened with external connection
> > > >
> > > > > Hi all,
> > > > >
> > > > > I would like to use iBatis on my project. I have some
> > > constraints :
> > > > > - I need to use a connection management mecanism external to
> > > iBatis.> > - I need to use a transactionnal mecanism external to
> > > iBatis (not EJB
> > > > > but another one).
> > > > >
> > > > > Following the javadoc example I have successfully inserted an
> > > > > object in
> > > > > database but I'm wondering if the javadoc example is 
> relevant for
> > > > > releasing resources.
> > > > >
> > > > > - do we have to close the session opened with an external
> > > > > connection ?
> > > > >
> > > > > - if we close the session what will happen for the underlying
> > > > > connection ?
> > > > >  is it closed ? (I would prefer not as connection is managed
> > > > > externally !)
> > > > >
> > > > > here's the code sample from the javadoc of
> > > SqlMapClient.openSession> > (Connection)
> > > > >  try {
> > > > >     Connection connection = dataSource.getConnection();
> > > > >     SqlMapSession session = sqlMap.openSession(connection);
> > > > >     // do work
> > > > >     connection.commit();
> > > > >   } catch (SQLException e) {
> > > > >       try {
> > > > >         if (connection != null) commit.rollback();
> > > > >       } catch (SQLException ignored) {
> > > > >         // generally ignored
> > > > >       }
> > > > >       throw e;  // rethrow the exception
> > > > >   } finally {
> > > > >     try {
> > > > >       if (connection != null) connection.close();
> > > > >     } catch (SQLException ignored) {
> > > > >       // generally ignored
> > > > >     }
> > > > >  }
> > > > >
> > > > > by the way there is a typo mistake --> commit.rollback();
> > > instead of
> > > > > connection.rollback();
> > > > >
> > > > > Thanks for your advices !
> > > > >
> > > > > Joe
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> >
> 
>

Reply via email to