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